boostorg / ublas

Boost.uBlas
https://www.boost.org/doc/libs/release/libs/numeric/ublas
111 stars 152 forks source link

Transpose for Rank One Tensors #120

Open amitsingh19975 opened 3 years ago

amitsingh19975 commented 3 years ago

As of now, the rank one tensor does not allow to be transposed.

auto const n = extents<>{3};
auto a = tensor_dynamic{n, 1.f};
auto c = tensor_dynamic{n};
std::vector<std::size_t> pi{3};
ublas::trans( 1ul, n.data(), pi.data(), c.data(), c.strides().data(),    a.data(), res.strides().data() ); // c = [0,0,0]
WilliamTambellini commented 1 year ago

same request here. Would also call for handling rank n tensors by transposing per slice.