romeric / Fastor

A lightweight high performance tensor algebra framework for modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reverse indexing

jakob0 opened this issue · 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.