Skip to content

Instantly share code, notes, and snippets.

@StefanKarpinski
Last active March 31, 2016 16:37
Show Gist options
  • Save StefanKarpinski/2de340ab7d4560f612ebdcc0463f01bc to your computer and use it in GitHub Desktop.
Save StefanKarpinski/2de340ab7d4560f612ebdcc0463f01bc to your computer and use it in GitHub Desktop.

Arrays as Containers

Definitely 0.5:

  • Flip the switch on the concatenation deprecation (#8599)
  • Deprecate partial linear indexing (#5396, #14770)
  • ReshapedArrays (#10507, #15449, https://groups.google.com/d/msg/julia-dev/7M5qzmXIChM/kOTlGSIvAwAJ)
  • Julia native bounds checking and removal (#7799, #14474)
  • Drop dimensions indexed by a scalar (#13612)
  • Full APL slicing (#15431)

Maybe 0.5

  • Disallow indexing with extra trailing singletons?

After 0.5

  • Return slices as views (#9150).
  • Allow any index type in non-scalar indexing (#12567)

Linear Algebra

  • Transpose returns a covector or transpose type (#4774)
  • Ditch special lowering of Ac_mul_Bt, use dispatch instead. (#5332)
  • Remove default no-op behavior for (c)transpose (#13171)
@ViralBShah
Copy link

linalg section also needs a before and after 0.5 section.

@timholy
Copy link

timholy commented Mar 31, 2016

I love the idea behind separating "arrays as containers" and "linear algebra," because the linear algebra seems much thornier. The big problem is that ReshapedArrays seem to get in the way of this plan. The performance benchmarks here show that we're fine (aka, awesome 😄) with reshaped LinearFast arrays, but not with reshaped LinearSlow arrays. Trying to fix this is basically the motivation behind my recent push to come up with a more sophisticated API for iteration.

However, if we're prepared to swallow that performance hit until 0.6, I actually think we could probably push ReshapedArrays over the line fairly quickly. There are only a handful of test failures left.

Before finishing #15449, it would be nice to know plans for having [f(x) for x in X] return an object of the same size (and dimensionality, obviously) as X. "Definitely 0.5," something later, or never?

@timholy
Copy link

timholy commented Mar 31, 2016

I realize I didn't spell out the connection between ReshapedArrays and linear algebra:

  • currently we dispatch to BLAS for StridedArray;
  • currently reshape(sub(A, indexes...), sz) creates a copy (returning an Array, which is Strided)
  • hence, this can be passed to BLAS

In a future world, reshape(sub(A, indexes...), sz) isn't Strided and so can't be passed to BLAS. Hence we rely on our fallbacks for linear algebra, which do indexing like A[i,j] and this will be slow.

The problems only crop up when you mix reshape and sub or slice. If A[:, 2:3] is going to not be a view in julia-0.5, this may not be sufficiently common to be a blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment