Fastor icon indicating copy to clipboard operation
Fastor copied to clipboard

Reverse indexing

Open jakob0 opened this issue 3 years ago • 0 comments

Hi, I'm not sure if this is supposed to work, but it would be quite helpful. I'm simply trying to reverse a Tensor in one dimension, e.g.:

0 1 2 3 4 5 6 7 8 to 6 7 8 3 4 5 0 1 2

This code almost does the job, but ends just before the last line: Tensor<double,3,3> A; A.iota(); auto B = A(fseq<2,0,-1>(), all);

I guess, Tensor<double,3,3> A; A.iota(); auto B = A(fseq<2,-1,-1>(), all); would be correct, but results in an overflow, since the second int in fseq is probably casted to an unsigned integer.

jakob0 avatar May 20 '21 13:05 jakob0