Tomographer  v5.3
Tomographer C++ Framework Documentation
Tomographer::MAT::DimList Class Reference

An array of ints which specifies a list of dimensions. More...

#include <tomographer/tools/ezmatio.h>

+ Inheritance diagram for Tomographer::MAT::DimList:
+ Collaboration diagram for Tomographer::MAT::DimList:

Public Member Functions

 DimList ()
 Initializes an empty dimension list.
 
template<typename VectorType >
 DimList (VectorType &&dims)
 Initialize a dimension list with another list of dimensions. More...
 
template<typename T , ENABLED_IF(std::is_convertible< T) int>
::value DimList (std::initializer_list< T > init)
 Initialize the dimension list with an explicit initializer. More...
 
template<class It >
 DimList (It b, It e)
 Initialize the dimension list with an iterator range. More...
 
int numel () const
 Get the total number of elements in an array of these dimensions. More...
 
int ndims () const
 Get the number of dimensions in this array. More...
 
bool matchesWanted (const DimList &wanted) const
 Test whether our dimensions match the given required list of dimensions. More...
 
DimListoperator<< (int dim)
 Add (append) a dimension to the dimension list. More...
 
DimListoperator<< (const std::vector< int > &moredims)
 Add (append) dimensions to the dimension list. More...
 
- Public Member Functions inherited from std::vector< int >
int push_back (int ... args)
 
int crbegin (int ... args)
 
int erase (int ... args)
 
int data (int ... args)
 
int insert (int ... args)
 
int pop_back (int ... args)
 
int shrink_to_fit (int ... args)
 
int back (int ... args)
 
int end (int ... args)
 
int resize (int ... args)
 
int emplace_back (int ... args)
 
int size (int ... args)
 
int cbegin (int ... args)
 
int front (int ... args)
 
int ~vector (int ... args)
 
int rbegin (int ... args)
 
int crend (int ... args)
 
int assign (int ... args)
 
int operator= (int ... args)
 
int vector (int ... args)
 
int reserve (int ... args)
 
int capacity (int ... args)
 
int empty (int ... args)
 
int cend (int ... args)
 
int swap (int ... args)
 
int max_size (int ... args)
 
int rend (int ... args)
 
int get_allocator (int ... args)
 
int clear (int ... args)
 
int at (int ... args)
 
int emplace (int ... args)
 
int operator[] (int ... args)
 
int begin (int ... args)
 

Additional Inherited Members

- Public Attributes inherited from std::vector< int >
int elements
 STL member.
 

Detailed Description

An array of ints which specifies a list of dimensions.

This utility may be used to specify a list of dimensions for a N-D array. It is a subclass of std::vector<int>, and implements some additional functions such as numel(), matchesWanted() and operator<<.

You may also use DimList::operator<<(int dim) and DimList::operator<<(const std::vector<int>& moredims) to append dimensions to the list.

Definition at line 306 of file ezmatio.h.

Constructor & Destructor Documentation

§ DimList() [1/3]

template<typename VectorType >
Tomographer::MAT::DimList::DimList ( VectorType &&  dims)
inline

Initialize a dimension list with another list of dimensions.

The dims may be another vector, or another DimList instance. This also works with move semantics.

Definition at line 318 of file ezmatio.h.

§ DimList() [2/3]

template<typename T , ENABLED_IF(std::is_convertible< T) int>
::value Tomographer::MAT::DimList::DimList ( std::initializer_list< T >  init)
inline

Initialize the dimension list with an explicit initializer.

Enables construction and initialization with the syntax

DimList dims{2, 3, 6}; // 3 dimensions initialized to [2, 3, 6]
DimList dims{{2, 3, 6}}; // 3 dimensions initialized to [2, 3, 6], alternative syntax
Todo:
Note to self: both syntaxes work, but I'm not sure which constructor exactly the second line calls ...?

Definition at line 334 of file ezmatio.h.

§ DimList() [3/3]

template<class It >
Tomographer::MAT::DimList::DimList ( It  b,
It  e 
)
inline

Initialize the dimension list with an iterator range.

The dimension list is initialized with begin and end iterators b and e. See std::vector(It b, It e).

Definition at line 344 of file ezmatio.h.

Member Function Documentation

§ matchesWanted()

bool Tomographer::MAT::DimList::matchesWanted ( const DimList wanted) const
inline

Test whether our dimensions match the given required list of dimensions.

Definition at line 364 of file ezmatio.h.

§ ndims()

int Tomographer::MAT::DimList::ndims ( ) const
inline

Get the number of dimensions in this array.

This is simply an alias for std::vector<int>::size()

Definition at line 359 of file ezmatio.h.

§ numel()

int Tomographer::MAT::DimList::numel ( ) const
inline

Get the total number of elements in an array of these dimensions.

This is simply the product of all elements in the array. See getNumEl().

Definition at line 352 of file ezmatio.h.

§ operator<<() [1/2]

DimList& Tomographer::MAT::DimList::operator<< ( int  dim)
inline

Add (append) a dimension to the dimension list.

Pushes the dimension dim at the end of the dimension list, increasing the number of dimensions by one.

Definition at line 382 of file ezmatio.h.

§ operator<<() [2/2]

DimList& Tomographer::MAT::DimList::operator<< ( const std::vector< int > &  moredims)
inline

Add (append) dimensions to the dimension list.

Pushes the dimension list moredims at the end of the current dimension list, increasing the number of dimensions by moredims.size().

Definition at line 391 of file ezmatio.h.


The documentation for this class was generated from the following file: