Open romeric opened 7 years ago
901f471 fixes the bug part of this issue.
This would also allow for code like this:
Tensor<int,9> v{0, 1, 2, 3, 4, 5, 6, 7, 8};
v({6, 3, 0}) = v({1, 2, 3});
which is possible with Eigen3. Right now I have to define intermediate tensors to accomplish this:
Tensor<int,9> v{0, 1, 2, 3, 4, 5, 6, 7, 8};
Tensor<int,3> i{6, 3, 0};
Tensor<int,3> j{1, 2, 3};
v(i) = v(j);
The operator() for tensors could be overloaded to provide a similar functionality to
seq
,fseq
andiseq
, like soThe tensor could then be indexed like
This would be pretty easy to achieve by just providing a
std::initializer_list
constructor toseq
. Note thatstd::initializer_list
constructors themselves are constexpr.This should however, be investigated, as at the moment
Tensor
class also hasstd::initializer_list
constructor and the above syntax already works but gives incorrect results and also this syntax seems more appropriate forTensorRandomViews
thanTensorViews
. In the sense, that it alludes to slicing a tensor with two vectors rather than with sequentially ascending ranges.