xdimension

Defined in xframe/xdimension.hpp

template<class L, class T = std::size_t>
class xdimension : private xf::xaxis<L, T, map_tag>

Class modeling dimensions.

The xdimension class is used for modeling the mapping of dimension names to their positions in a data tensor. This class is a special axis with a broadcast method instead of merge and intersect, thus its API is really close the one of xaxis.

See

xaxis

Template Parameters
  • L: the type of dimension name.

  • T: the integer type use to represent the positions of the dimensions. Default value is std::size_t.

Public Functions

xdimension()

Constructs an empty xdimension object.

xdimension(const label_list &labels)

Constructs an xdimension object with the given list of dimension labels.

This list is copied.

Parameters
  • labels: the list of dimension names.

xdimension(label_list &&labels)

Constructs an xdimension object with the given list of dimension labels.

This list is moved and therefore it is invalid after the xdimension object has been constructed.

Parameters
  • labels: the list of dimension names.

xdimension(std::initializer_list<key_type> init)

Constructs an xdimension object from the given initializer list of dimension names.

Parameters
  • init: the list of dimension names.

template<class InputIt>
xdimension(InputIt first, InputIt last)

Constructs an xdimension object from the content of the range [first, last)

Parameters
  • first: An iterator to the first dimension name.

  • last: An iterator the the element following the last dimension name.

template<class ...Args>
bool broadcast(const Args&... dims)

Broadcast the specified dimensions to this xdimension object.

Return

true if the dimension objects are the same.

Parameters
  • dims: the xdimension objects to broadcast.

template<class L, class T>
bool xf::operator==(const xdimension<L, T> &lhs, const xdimension<L, T> &rhs)

Returns true if lhs and rhs are equivalent dimension mappings, i.e.

they contain the same dimension name - dimension position pairs.

Parameters
  • lhs: an xdimension object.

  • rhs: an xdimension obejct.

template<class L, class T>
bool xf::operator!=(const xdimension<L, T> &lhs, const xdimension<L, T> &rhs)

Returns true if lhs and rhs are not equivalent dimension mappings, i.e.

they contain different dimension name - dimension position pairs.

Parameters
  • lhs: an xdimension object.

  • rhs: an xdimension obejct.