Best syntax for a diagonal and vertical slice

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 24 02:59:21 PDT 2017


On Saturday, 22 July 2017 at 20:55:06 UTC, kerdemdemir wrote:
> And what if I want to go diagonal like 1,5,9 or 3,5,7 in the 
> example above. Is there a good solution in std without using 
> for loops?

I suggest using an actual matrix type for tasks like this. I 
don't know about diagonal slicing, but the implementation here at 
least provides accessors for both rows and columns.

https://github.com/pineapplemachine/mach.d/blob/master/mach/math/matrix.d



More information about the Digitalmars-d-learn mailing list