19 #include <tensor/tensor.h>
20 #include <tensor/detail/common.h>
24 using namespace tensor;
26 template<
typename Tensor>
32 output.at(0) = mean(t);
35 ndx = normalize_index(ndx, rank);
37 tensor::index left = 1, middle, right = 1;
38 for (
int i = 0, j = 0; i < rank; i++) {
40 dimensions.at(j++) = d;
50 for (tensor::index r = 0; r < right; r++)
51 for (tensor::index m = 0; m < middle; m++)
52 for (tensor::index l = 0; l < left; l++)
53 output.
at(l,r) += aux(l,m,r);
54 return output /
typename Tensor::elt_t(middle);
int rank() const
Number of Tensor indices.
An N-dimensional array of numbers.
static const Tensor< elt_t > zeros(index rows)
Matrix of zeros.
const RTensor reshape(const RTensor &t, const Indices &new_dims)
Return a RTensor with same data and given dimensions.
Vector of 'index' type, where 'index' fits the indices of a tensor.
index dimension(int which) const
Length of a given Tensor index.
elt_t & at(index i)
Return a mutable reference to an element of a 1D Tensor.