-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arraypocalypse Now and Then #255
Comments
This looks like a great list Matt, thanks. I'm a little scared of the On Tuesday, September 15, 2015, Matt Bauman [email protected]
|
Yes, great list! Let's roll up our sleeves! |
Are there any pieces of this that are unclaimed? I'd like to help, but I On Tuesday, September 15, 2015, Jeff Bezanson [email protected]
|
It's a phenomenal list. There's actually only a few changes that are very breaking, which is nice, but those are significant enough. |
There is definitely more than enough work to go around! I don't think any of these tasks are claimed. Things like dropping scalar dimensions are rather simple changes, but will take a lot of work finding and fixing bugs... and that part is easy to collaborate on. Same goes for views (if you ignore the perf issues with ReshapedArrays and inbounds). Anyone is welcome to dig in! |
Views is hard, you have to make it through bootstrap without 🔪 yourself in the 👀. |
Having just done a bunch of work to get string changes through bootstrap, I'm inclined to believe this. |
Thanks for doing this @mbauman, so much to digest |
I've added "Remove default no-op behavior for (c)transpose" as an item. I expect much complaining, but as we've discussed before, it's simply wrong to assume that |
I think we need to think through the options for that carefully. It's pretty idiomatic to write |
Isn't it possible that the (c)transpose wrapper will solve this issue? There's a lot of design work that will need to go into it, but: transpose(A::AbstractVectorOrMatrix) = TransposeType(A) # Will call `transpose` upon indexing, too
transpose(::AbstractArray) = error("cannot take transpose of 3+ dim array") # yeah, error methods aren't the best…
transpose(x) = x |
related: I think some of the typing problems in linalg (and transpose behavior) comes from the fact that we represent a blocked linear operator as an array of arrays. We may want to switch to a new type that knows of the various sizes inside it for that, I remember discussing that with @andreasnoack. 0.5 might be a time to at least think about it. |
Maybe; we'd have to think about it. The blocking issue last time is that transpose has to be recursive to handle cases like To be clear, the behavior we would break explicitly is the claim (which you can find in the help for
This equivalence makes no sense for types that are not |
I think assuming that a Matrix{Matrix} will automatically recursively On Wed, Sep 16, 2015 at 10:30 AM, Jiahao Chen [email protected]
|
@tbreloff that's exactly my point. Most people think it's odd that transpose should be recursive, but it must be to be a mathematically correct transpose, and that disquiet exposes corner cases where transposition is not simply |
Ah, yes, I forgot about all the Tensor-like objects that aren't AbstractArrays. No matter what happens, either the authors of Tensor-like objects will need to communicate to Julia somehow that they're not scalars (sometimes being an AbstractArray works, but not always), or the authors of Scalar-like objects will need to do the reverse (sometimes being a Number works, but not always), or both. This same sort of scalar-or-not question rears its head all over the place… e.g., indexing: JuliaLang/julia#12567. Right now we require a mishmash of method specializations for the tensors with some scalar-like fallbacks. This means that some get forgotten and we end up with scalar methods getting called, returning the wrong result. Since we can't communicate this through supertypes (JuliaLang/julia#987 (comment)), I think it's gotta either be through better documentation of the required methods or having those methods explicitly encoded into a traits-based system. And if we remove all fallbacks (which ensures correct behavior at the cost of missing methods for everyone), I think we need to make this as simple as possible with traits. |
+1 I really think we should start enumerating traits for AbstractArray's. Linear indexing seems to have been an amazing example of the power of a few careful design decisions involving traits. |
One possible solution would be to keep Note that this is distinct from and much more well-defined than an |
@johnmyleswhite By any chance did you mean language supported "traits"? That's one thing I've really wanted to see in the language since JuliaCon. |
Yes, I meant language supported traits. |
Do you have any ideas/suggestions about how traits could be added to Julia, syntactically? They would be very useful for arrays, strings, encodings, at the very least. |
I prefer leaving those decisions to Jeff rather than speculating. |
Given that this is an umbrella issue, it would be nice to discuss specific items in their own issues. |
I do think though that having traits in the language might substantially change the design for Arrays, which is why discussion of traits, at least in the area of how they could be used for better Array abstractions, would be useful. |
Please move traits discussion to JuliaLang/julia#5, and the (c)transpose issue to JuliaLang/julia#13171. |
I don't think the syntax for traits needs to be figured out before figuring out what traits are important for arrays. In fact, having more examples of traits that we actually need is excellent for helping design the language feature. |
Ok, good point, as long as traits are being thought of as part of the design. |
Upper and lower for triangular matrices? Those seem like good candidates for being done as traits to me. |
Has there been any consideration of renaming |
|
Following up on @davidanthoff, I think we should deprecate either |
It's a mix of both, but if we detangle scalar/nonscalar |
Ah, I had thought the base capability is now a complete superset of the |
It seems unfortunate and somewhat backwards for a name used in a package to block choosing a much clearer name for a function in Base. Perhaps the way forward is to eliminate the performance advantage of ArrayViews, deprecate that package, and change the function name to Base.view. |
My assumption/hope is that the performance gap will go away when we are able to That's why the difference only shows up with creation of small arrays---on most other benchmarks, Oh, and I agree about deprecating |
Base and |
I suppose that could work because module A
function myfunc(a::AbstractMatrix)
av = view(a, :, 1)
# do something with av
end
end
module B
using ArrayViews
end Does |
ImageView would also have to stop exporting |
Of the remaining issues, only #57 and JuliaLang/julia#16846 remain for 0.5; moving this issue to 0.6. |
I'm also planning to do JuliaLang/julia#16260 (comment):
Probably won't be done until after JuliaCon, unfortunately. In that same discussion, @eschnett has made a case for introducing a separate type for linear indexing, and pointed out that the introduction of |
As long as you're on it, @timholy – needs to be done by next week so we can tag an RC. If you'd like to open an issue and put it in the 0.5.0 milestone so we can track it, you can. |
Shouldn't the title be adapted, if the milestone is moved? |
I believe the 0.6 parts of this are reflected in more specific issues and PRs; moving to 1.0. |
See also JuliaLang/julia#20164 to more easily opt-in to views for a large block of code. |
Everything in this issue is either done, has its own issue, or isn't going to happen (I checked). |
This issue supersedes the 0.4 work towards array nirvana (#7941), and
willtracks the issues we aim to complete during 0.5 and beyond — now updated through work on 0.7. This is an umbrella issue and will track specific tasks in other issues. Please feel free to add things that I've missed.Required underlying technologies
@inbounds
elide code blocks hidden within an@boundscheck
macro, propagating down only one level of inlining (extensible bounds checking removal julia#7799 (comment)). This is a strong requirement for the subsequent steps. (implemented in elide code marked with@boundscheck(...)
. julia#14474)Major 0.5 breaking behavior changes
sub
behaviour toslice
(#16846)Major 0.6 breaking behavior changes
RowVector
as the transpose of a vector julia#19670.Possible future breaking changes
Return slices as views. A first attempt at this was at RFC: Return views from UnitRange indexing of Arrays julia#9150. Still unclear whether the possible performance changes are consistent and large enough to be worth the breakage.See range indexing should produce a subarray, not a copy julia#3701.New functionality
Allow any index type in non-scalar indexing (#12567).Tighten scalar indexing to indicesMore systematic conversion of indices such that any index type can be converted into an<: Integer
and widen non scalar indexing to<: Union{Number, AbstractArray, Colon}
(RFC: Allow any index type in nonscalar indexing julia#12567 (comment)).Int
orAbstractArray
: RFC: Speedier, simpler and more systematic index conversions julia#19730Other speculative possibilities
Array
definition (#12447); this type could also be used for I/O buffers and string storage.IndexSet
IntSet
onBitArray
or perhaps any. (#20456)AbstractArray{Bool}
find
on logical arrays and simply wrap it with anIndexSet
LogicalIndex
instead? (#19730)IndexSet
(NegatedIndex type julia#1032) or specialNot
type? (Perhaps in a package: https://github.com/mbauman/InvertedIndices.jl)Only allow indexing into N-dimensional arrays with 1 or N indices, deprecating "partial" indexing and trailing singleton dimensions (Omitted and additionally indexed dimensions in getindex julia#5396 and deprecate (then remove) generalized linear indexing julia#14770). Initial attempt at WIP/RFH: Deprecate generalized linear indexing julia#20040.Only allow linear indexing when there is exactly one index provided. Only allow omitting indices (using less than N indices in an N-dimensional array) when all omitted dimensions are of length 1. Only allow trailing indices (more than N indices) when all indices are 1 (singletons). (#21750)T[...]
) is kind of a bad pun. This syntax is especially bad since some variations are parsed as indexing into a type while others are parsed as special forms (typed hvcat, typed comprehensions)@sub
@view
macro (#16564)The text was updated successfully, but these errors were encountered: