Function rearrange_and_copy (o2scl)

O2scl : Function List

template<class tensor_t, class data_t>
tensor_t o2scl::rearrange_and_copy(const tensor_t &t, std::vector<index_spec> spec, int verbose = 0, bool err_on_fail = true)

Rearrange, sum and copy current tensor to a new tensor.

Todo:

We need to check all of the degenerate cases, for example, a range spec. with only one element, a grid specification with only one element in the result, etc.

Todo

In tensor::rarrange_and_copy():

Future: Return a scalar if possible as a rank 1 tensor with 1 element.

template<class tensor_t, class data_t>
tensor_t o2scl::rearrange_and_copy(const tensor_t &t, std::string spec, int verbose = 0, bool err_on_fail = true)

Rearrange, sum and copy current tensor to a new tensor (string input version)