Skip to content
This repository was archived by the owner on Jan 12, 2020. It is now read-only.

Add blog post on challenging AbstractArray types #366

Merged
merged 1 commit into from
Mar 31, 2016
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Mar 28, 2016

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.

```jl
function copy!(dest, src)
for (idest, isrc) in zip(eachindex(dest), eachindex(src))
dest[idest] = src[idest]
Copy link
Contributor

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?

Copy link
Member Author

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
Copy link

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?

Copy link
Member Author

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."

Copy link
Member

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 dth 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).

@jrevels
Copy link
Member

jrevels commented Mar 29, 2016

Might be a config issue on my end, but I get an error when trying to build the site with this post:

➜  julialang.github.com git:(teh/arrays) jekyll serve
Configuration file: /Users/jarrettrevels/data/code/julialang.github.com/_config.yml
            Source: /Users/jarrettrevels/data/code/julialang.github.com
       Destination: /Users/jarrettrevels/data/code/julialang.github.com/_site
      Generating...
Error reading file /Users/jarrettrevels/data/code/julialang.github.com/blog/_posts/2016-03-27-arrays-iteration.md: (<unknown>): mapping values are not allowed in this context at line 3 column 36

The rest of the site is unaffected, but the formatting of this post becomes wonky:

screen shot 2016-03-29 at 10 57 57 am

@timholy
Copy link
Member Author

timholy commented Mar 29, 2016

Maybe the last commit will fix it, @jrevels? Thanks for checking!

@@ -1,7 +1,7 @@
---
layout: post
title: Generalizing AbstractArrays: opportunities and challenges
Copy link
Member

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".

@timholy
Copy link
Member Author

timholy commented Mar 30, 2016

OK, comments addressed. The reviews have been very helpful!

If no more concerns arise, I'll squash and merge this evening (or so).

@timholy timholy merged commit 6da1a62 into master Mar 31, 2016
@timholy timholy deleted the teh/arrays branch March 31, 2016 12:24
@tomasaschan
Copy link
Member

For reference and easy navigation: JuliaLang/julia#15648 is the issue where discussion continues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants