xtensor_fixed¶
Defined in xtensor/xfixed.hpp
-
template<class ET, class S, layout_type L, bool SH, class Tag>
class xfixed_container : public xt::xcontainer<xfixed_container<ET, S, L, SH, Tag>>, public xt::xcontainer_semantic<xfixed_container<ET, S, L, SH, Tag>>¶ Dense multidimensional container with tensor semantic and fixed dimension.
The xfixed_container class implements a dense multidimensional container with tensor semantic and fixed dimension
See also
- Template Parameters
ET – The type of the elements.
S – The xshape template paramter of the container.
L – The layout_type of the tensor.
SH – Wether the tensor can be used as a shared expression.
Tag – The expression tag.
Constructors
-
inline explicit xfixed_container(const inner_shape_type &shape, layout_type l = L)¶
Create an uninitialized xfixed_container.
Note this function is only provided for homogeneity, and the shape & layout argument is disregarded (the template shape is always used).
- Parameters
shape – the shape of the xfixed_container (unused!)
l – the layout_type of the xfixed_container (unused!)
-
inline explicit xfixed_container(const inner_shape_type &shape, value_type v, layout_type l = L)¶
Create an xfixed_container, and initialize with the value of v.
Note, the shape argument to this function is only provided for homogeneity, and the shape argument is disregarded (the template shape is always used).
- Parameters
shape – the shape of the xfixed_container (unused!)
v – the fill value
l – the layout_type of the xfixed_container (unused!)
-
template<class IX = std::integral_constant<std::size_t, N>, class EN = std::enable_if_t<IX::value != 0, int>>
inline xfixed_container(nested_initializer_list_t<value_type, N> t)¶ Allocates an xfixed_container with shape S with values from a C array.
The type returned by get_init_type_t is raw C array
value_type[X][Y][Z]
forxt::xshape<X, Y, Z>
. C arrays can be initialized with the initializer list syntax, but the size is checked at compile time to prevent errors. Note: for clang < 3.8 this is an initializer_list and the size is not checked at compile-or runtime.
Extended copy semantic
-
template<class E>
inline xfixed_container(const xexpression<E> &e)¶ The extended copy constructor.
-
template<class E>
inline auto operator=(const xexpression<E> &e) -> self_type&¶ The extended assignment operator.
Public Functions
-
template<class ST = std::array<std::size_t, N>>
inline void resize(ST &&shape, bool force = false) const¶ Note that the xfixed_container cannot be resized.
Attempting to resize with a different size throws an assert in debug mode.
-
template<class ST = shape_type>
inline void resize(ST &&shape, layout_type l) const¶ Note that the xfixed_container cannot be resized.
Attempting to resize with a different size throws an assert in debug mode.
-
template<class ST = shape_type>
inline void resize(ST &&shape, const strides_type &strides) const¶ Note that the xfixed_container cannot be resized.
Attempting to resize with a different size throws an assert in debug mode.
-
template<class ST = std::array<std::size_t, N>>
inline const auto &reshape(ST &&shape, layout_type layout = L) const¶ Note that the xfixed_container cannot be reshaped to a shape different from
S
.
-
typedef xfixed_container<T, FSH, L, Sharable> xt::xtensor_fixed¶
Alias template on xfixed_container with default parameters for layout type.
This allows to write
xt::xtensor_fixed<double, xt::xshape<2, 2>> a = {{1., 2.}, {3., 4.}};
instead of the syntax
xt::xfixed_container<double, xt::xshape<2, 2>, xt::layout_type::row_major> a = ...
- Template Parameters
T – The value type of the elements.
FSH – A xshape template shape.
L – The layout_type of the tensor (default: XTENSOR_DEFAULT_LAYOUT).
Sharable – Whether the tensor can be used in a shared expression.