Upsurge
Upsurge copied to clipboard
Thoughts on architecture update (slicing, etc.)
Followup of our twitter conversation.
You'll find a gist with a rethinking of the basic types to make them more similar to NumPy's:
- make Matrix and MatrixSlice a single type (also remove Slices for Array and Tensor).
- more powerful slicing, (more like NumPy, including step and reverse direction). Taking some distance from Swift's conventions (ArraySlice have same index as their Array, I don't think this is suitable in this use case: 0-based indexes for slices make more sense IMO)
- removal of [Int] as index type when dimension is known (Matrix is 2D -> 2 values). Keep [Int] for unknown dimensions (generic N-D Tensor)
- interaction with external memory storage (good for memory managed by Metal for instance), including non compact layout (offset between rows).
What's not done is reflection about mutability (everything is mutable).
https://gist.github.com/rsebbe/fb2ac50c0cfaa9f2228822eeabf9e659
Feel free to let me know what you think, and if that's a direction you'd like to try for Upsurge.