-
-
Notifications
You must be signed in to change notification settings - Fork 275
Add blog post on challenging AbstractArray types #366
Conversation
```jl | ||
function copy!(dest, src) | ||
for (idest, isrc) in zip(eachindex(dest), eachindex(src)) | ||
dest[idest] = src[idest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intentionally not using isrc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's a typo. Thanks for catching.
converted to one of the allowed keys, for that specific array, | ||
result in `BoundsError`s. | ||
|
||
- For any given array, at least one complete independent set of keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this interact with the Interpolations array that you mentioned in the intro? It has to be able to generate a complete set of floating point numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, good point. I guess by "complete" I'm back to thinking about discrete (integer-like) indexes. There have been arguments made that Interpolations should not be arrays and not use getindex
to calculate values; one reaction is that this argument just got a little stronger.
Alternatively, we could discard this point. My intent here was to specify that, unlike traditional associative containers, the array doesn't have to store the "keys."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "complete set" could also here be defined not by an actual list of values, but rather of intervals (just as today); an d
th index i
is in the set if 1 <= i <= size(itp,d)
. This isn't conceptually much different from how a range object behaves: rather than storing all the values for all the allowed keys, there is an exact definition of which keys are allowed, and the values for those keys might be computed at indexing-time. (Interpolation arrays, like ranges, are also read-only.)
Arguably, though, iteration over interpolation arrays doesn't make much sense. The least weird thing to do (and what Interpolations.jl does today, to my knowledge) is to just return the values on each provided data point. In other words, iterating over an interpolation array yields the same results as iterating over the underlying data set (except that you can't set the value).
Might be a config issue on my end, but I get an error when trying to build the site with this post:
The rest of the site is unaffected, but the formatting of this post becomes wonky: |
Maybe the last commit will fix it, @jrevels? Thanks for checking! |
@@ -1,7 +1,7 @@ | |||
--- | |||
layout: post | |||
title: Generalizing AbstractArrays: opportunities and challenges |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the web link didn't seem to fix the build issue - I think it's the unescaped second colon in title: Generalizing AbstractArrays: opportunities and challenges
that's causing the trouble. Quoting the title fixed it for me, e.g. title: "Generalizing AbstractArrays: opportunities and challenges"
.
OK, comments addressed. The reviews have been very helpful! If no more concerns arise, I'll squash and merge this evening (or so). |
For reference and easy navigation: JuliaLang/julia#15648 is the issue where discussion continues. |
As described here, this is introductory material describing some challenges for supporting certain array types and operations. It will be paired with a shortly-to-be-filed GitHub issue outlining possible solutions.
If upon review you find this unsatisfying as a blog post, or find the split between problem & solution awkward, please recommend a better forum.