libidx
ebl::idxd< T > Class Template Reference

#include <idxspec.h>

Inheritance diagram for ebl::idxd< T >:
ebl::smart_pointer

List of all members.

Public Member Functions

 idxd ()
 Empty constructor, creates an empty idxd.
 idxd (const idxspec &s)
 Create an idxd based on the information found in an idxspec.
template<class T2 >
 idxd (const idx< T2 > &i)
 Create an idxd based on the information found in an idx<T2>.
template<class T2 >
 idxd (const idxd< T2 > &i)
 Create an idxd based on the information found in an idxd<T2>.
 idxd (const idxd< T > &s)
 Create an idxd based on the information found in an idxd.
 idxd (T s0, T s1=-1, T s2=-1, T s3=-1, T s4=-1, T s5=-1, T s6=-1, T s7=-1)
 Generic constructor.
virtual ~idxd ()
 Destructor.
void setdim (intg dimn, T size)
template<class Tidx >
void setdims (const idx< Tidx > &i)
 Set sames dimensions as an idx.
void setdims (const idxd< T > &s)
 Set sames dimensions as an idxd.
void setdims (const idxspec &s)
 Set sames dimensions as an idxspec.
void setdims (T n)
 Set all existing dimensions to n.
void insert_dim (intg pos, T dim_size)
remove_dim (intg pos)
void setoffset (intg dimn, T offset)
 Set the offset of dimensions 'dimn' to 'offset'.
bool has_offsets () const
 Returns true if this object contains offsets or not.
void set_max (const idxd< T > &other)
void shift_dim (int d, int pos)
 Shift dimension 'd' to position 'pos'.
bool empty () const
 Returns true if this idxd has not been set at all.
intg order () const
 Returns the order.
dim (intg dimn) const
 Returns the size of dimension 'dimn'.
maxdim () const
 Returns the size of biggest dimension.
offset (intg dimn) const
 Returns the offset of dimension 'dimn'.
bool operator== (const idxd< T > &other)
 Return true if dimensions and order are equal (regardless of offsets).
bool operator!= (const idxd< T > &other)
intg nelements ()
 Return total number of elements.
idxd< T > & operator= (idxd< T > d2)
 Assign idxd 'd2' into current idxd (copies offsets if they exist).
template<typename T2 >
idxd< T > & operator= (const idxd< T2 > &d2)
idxd< T > operator* (const idxd< T > &d2) const
template<typename T2 >
idxd< T > operator* (const idxd< T2 > &d2) const
template<typename T2 >
idxd< T > operator* (idxd< T2 > &d2)
template<typename T2 >
idxd< T > operator* (T2 d)
 Return an idxd who's dimensions and offsets are multiplied by d.
template<typename T2 >
idxd< T > operator+ (T2 d)
 Return an idxd who's dimensions are added d.
idxd< T > operator+ (idxd< T > &d2)
 Return the addition of this idxd with another one 'd2' with same order.
bool operator<= (idxd< T > &d2)
bool operator>= (idxd< T > &d2)

Protected Attributes

dims [MAXDIMS]
 Size of each dimension.
intg ndim
 Order, i.e. number of dimensions.
T * offsets
 Offsets (optional).

Friends

class idxspec
template<typename T2 >
std::string & operator<< (std::string &out, const idxd< T2 > &d)

Detailed Description

template<typename T>
class ebl::idxd< T >

This class allows to extract dimensions information from existing idx objects in order to create other idx objects with the same order without knowning their order in advance. One can modify the order, each dimensions and their offsets. Offsets are 0 by default, but can be used to define bounding boxes for a n-dimensional tensor.


Member Function Documentation

template<typename T>
void ebl::idxd< T >::insert_dim ( intg  pos,
dim_size 
)

Insert a dimension of size dim_size at position pos, shifting all dimensions after pos and incrementing order by 1. This is valid only if all dimensions up to pos (excluded) are > 0.

template<typename T>
bool ebl::idxd< T >::operator!= ( const idxd< T > &  other)

Return true if dimensions and/or order are different (regardless of offsets).

template<typename T>
idxd< T > ebl::idxd< T >::operator* ( const idxd< T > &  d2) const

Return an idxd who's each dimension and offset is multiplied with each dimension of idxd 'd2'.

template<typename T >
template<typename T2 >
idxd< T > ebl::idxd< T >::operator* ( const idxd< T2 > &  d2) const

Return an idxd who's each dimension and offset is multiplied with each dimension of idxd 'd2'.

template<typename T >
template<typename T2 >
idxd< T > ebl::idxd< T >::operator* ( idxd< T2 > &  d2)

Return an idxd who's each dimension and offset is multiplied with each dimension of idxd 'd2'.

template<typename T>
bool ebl::idxd< T >::operator<= ( idxd< T > &  d2)

Return true if all of this idxd's dimensions are <= to corresponding dimensions in d2.

template<typename T >
template<typename T2 >
idxd< T > & ebl::idxd< T >::operator= ( const idxd< T2 > &  d2)

Assign idxd 'd2' with different type into current idxd (copies offsets if they exist).

template<typename T>
bool ebl::idxd< T >::operator>= ( idxd< T > &  d2)

Return true if all of this idxd's dimensions are >= to corresponding dimensions in d2.

template<typename T >
T ebl::idxd< T >::remove_dim ( intg  pos)

Remove dimension at position pos and return it, shifting all dimensions after pos and decrementing order by 1. This is valid only if all dimensions up to pos (excluded) are > 0.

template<typename T>
void ebl::idxd< T >::set_max ( const idxd< T > &  other)

Set each dimension of this idxd to the max of this one and 'other'. Note: 'other' and this idx are expected to have the same order.

template<typename T>
void ebl::idxd< T >::setdim ( intg  dimn,
size 
)

Change the dimensions dimn to size size. One cannot change the order of an idxd, only existing dimensions can be changed.


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