rtensor

template<class T, std::size_t N>
class rtensor : public xt::rcontainer<rtensor<T, N>>, public xcontainer_semantic<rtensor<T, N>>

Multidimensional container providing the xtensor container semantics wrapping an R array.

rtensor is similar to the xtensor container in that it has a static dimensionality.

Unlike the rarray container, rtensor cannot be reshaped with a different number of dimensions and reshapes are not reflected on the R side. However, rtensor has benefits compared to rarray in terms of performances. rtensor shapes are stack-allocated which makes iteration upon rtensor faster than with pyarray.

See also

rarray

Template Parameters:

T – The type of the element stored in the rarray.

Constructors

inline rtensor()

Allocates an uninitialized rtensor.

inline rtensor(nested_initializer_list_t<T, N> t)

Allocates a rtensor with a nested initializer list.

inline explicit rtensor(const shape_type &shape)

Allocates an uninitialized rtensor with the specified shape and layout.

Parameters:
  • shape – the shape of the rtensor

  • l – the layout_type of the rtensor

inline explicit rtensor(const shape_type &shape, const_reference value)

Allocates a rtensor with the specified shape and layout.

Elements are initialized to the specified value.

Parameters:
  • shape – the shape of the rtensor

  • value – the value of the elements

  • l – the layout_type of the rtensor

Copy semantic

inline rtensor(const self_type &rhs)

The copy constructor.

inline self_type &operator=(const self_type &rhs)

The assignment operator.

Extended copy semantic

template<class E>
inline rtensor(const xexpression<E> &e)

The extended copy constructor.

template<class E>
inline auto operator=(const xexpression<E> &e) -> self_type&

The extended assignment operator.