crystal-data / num.cr

Scientific computing in pure Crystal
MIT License
151 stars 12 forks source link

Support matrix indexing with a list of rows and a slice of columns and vice versa. #1

Closed christopherzimmerman closed 4 years ago

christopherzimmerman commented 5 years ago

Right now, there is no way to do the following index:

m = Matrix.new [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
m[[0, 1], 1...3]

 # should return a matrix
 # [[2.0, 3.0]
 #  [5.0, 6.0]]

This should be a COPY, not a view, since it can be non-contiguous.