kyonifer / koma

A scientific computing library for Kotlin. https://kyonifer.github.io/koma
Other
270 stars 23 forks source link

is there a wildcard for matrix indexing? #25

Closed austin-sandia closed 7 years ago

austin-sandia commented 7 years ago

for instance something like

A[0..5,:]

?

or do I have to do

A[0..5,0 until numCols]

?

beautiful project.

thanks.

kyonifer commented 7 years ago

Thanks for reporting.

I don't, but its definitely something that should be added. I'm considering:

A[0..3, 3..end]
A[0..3, all]
austin-sandia commented 7 years ago

those look great.

austin-sandia commented 7 years ago

looking good . . . might as well add a "begin" or "first" to complete the triangle.

kyonifer commented 7 years ago

My only concern there is that we'd be polluting the namespace with common identifiers, making it harder to import golem.*. I'd probably end up using 0..end anyway since thats shorter than start..end. The current approach matches MATLAB's 1:end, which would be good for people coming from that background.

I'd much prefer numpy's A[:] or MATLAB's A(:) syntax, but unfortunately Kotlin's syntax doesn't support anything like A[5..] or A[,1..2]

austin-sandia commented 7 years ago

apologies. agreed that 0 is better than "first."