pyarray

template <class T>
class xt::pyarray

Multidimensional container providing the xtensor container semantics to a numpy array.

pyarray is similar to the xarray container in that it has a dynamic dimensionality. Reshapes of a pyarray container are reflected in the underlying numpy array.

See
pytensor
Template Parameters
  • T: The type of the element stored in the pyarray.

Inherits from xt::pycontainer< pyarray< T > >, xcontainer_semantic< pyarray< T > >

Constructors

pyarray(const value_type &t)

Allocates a pyarray with nested initializer lists.

pyarray(const shape_type &shape, layout_type l = layout_type::row_major)

Allocates an uninitialized pyarray with the specified shape and layout.

Parameters
  • shape: the shape of the pyarray
  • l: the layout of the pyarray

pyarray(const shape_type &shape, const_reference value, layout_type l = layout_type::row_major)

Allocates a pyarray with the specified shape and layout.

Elements are initialized to the specified value.

Parameters
  • shape: the shape of the pyarray
  • value: the value of the elements
  • l: the layout of the pyarray

pyarray(const shape_type &shape, const strides_type &strides, const_reference value)

Allocates an uninitialized pyarray with the specified shape and strides.

Elements are initialized to the specified value.

Parameters
  • shape: the shape of the pyarray
  • strides: the strides of the pyarray
  • value: the value of the elements

pyarray(const shape_type &shape, const strides_type &strides)

Allocates an uninitialized pyarray with the specified shape and strides.

Parameters
  • shape: the shape of the pyarray
  • strides: the strides of the pyarray

Copy semantic

pyarray(const self_type &rhs)

The copy constructor.

auto operator=(const self_type &rhs)

The assignment operator.

Extended copy semantic

template <class E>
pyarray(const xexpression<E> &e)

The extended copy constructor.

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

The extended assignment operator.