Psi4
Public Member Functions | Private Attributes | Friends | List of all members
psi::Dimension Class Reference

#include <dimension.h>

Public Member Functions

 Dimension ()
 
 Dimension (const Dimension &other)
 
 Dimension (int n, const std::string &name="")
 
 Dimension (const std::vector< int > &other)
 
 ~Dimension ()
 
Dimensionoperator= (const Dimension &other)
 Assignment operator. More...
 
Dimensionoperator= (const int *other)
 Assignment operator, this one can be very dangerous. More...
 
Dimensionoperator+= (const Dimension &b)
 
Dimensionoperator-= (const Dimension &b)
 
void init (int n, const std::string &name="")
 Re-initializes the object. More...
 
int n () const
 Return the rank. More...
 
const std::string & name () const
 Return the name of the dimension. More...
 
void set_name (const std::string &name)
 Set the name of the dimension. More...
 
int & operator[] (int i)
 Blocks access. More...
 
const int & operator[] (int i) const
 
const std::vector< int > & blocks () const
 
 operator int * ()
 Casting operator to int*. More...
 
 operator const int * () const
 Casting operator to const int*. More...
 
int sum () const
 Return the sum of constituent dimensions. More...
 
int max () const
 
void zero ()
 Zero all the elements. More...
 
void fill (int v)
 Fill all elements in blocks_ with given value. More...
 
void print () const
 
const int & get (int i) const
 
void set (int i, int val)
 

Private Attributes

std::string name_
 
std::vector< int > blocks_
 

Friends

bool operator== (const Dimension &a, const Dimension &b)
 
bool operator!= (const Dimension &a, const Dimension &b)
 
Dimension operator+ (const Dimension &a, const Dimension &b)
 
Dimension operator- (const Dimension &a, const Dimension &b)
 

Constructor & Destructor Documentation

psi::Dimension::Dimension ( )
psi::Dimension::Dimension ( const Dimension other)
psi::Dimension::Dimension ( int  n,
const std::string &  name = "" 
)
psi::Dimension::Dimension ( const std::vector< int > &  other)
psi::Dimension::~Dimension ( )

Member Function Documentation

const std::vector<int>& psi::Dimension::blocks ( ) const
inline
void psi::Dimension::fill ( int  v)

Fill all elements in blocks_ with given value.

const int& psi::Dimension::get ( int  i) const
inline
void psi::Dimension::init ( int  n,
const std::string &  name = "" 
)

Re-initializes the object.

int psi::Dimension::max ( ) const
int psi::Dimension::n ( ) const
inline

Return the rank.

const std::string& psi::Dimension::name ( ) const
inline

Return the name of the dimension.

psi::Dimension::operator const int * ( ) const
inline

Casting operator to const int*.

psi::Dimension::operator int * ( )
inline

Casting operator to int*.

Dimension & psi::Dimension::operator+= ( const Dimension b)
Dimension & psi::Dimension::operator-= ( const Dimension b)
Dimension & psi::Dimension::operator= ( const Dimension other)

Assignment operator.

Dimension & psi::Dimension::operator= ( const int *  other)

Assignment operator, this one can be very dangerous.

int& psi::Dimension::operator[] ( int  i)
inline

Blocks access.

const int& psi::Dimension::operator[] ( int  i) const
inline
void psi::Dimension::print ( void  ) const
void psi::Dimension::set ( int  i,
int  val 
)
inline
void psi::Dimension::set_name ( const std::string &  name)
inline

Set the name of the dimension.

int psi::Dimension::sum ( ) const

Return the sum of constituent dimensions.

void psi::Dimension::zero ( void  )

Zero all the elements.

Friends And Related Function Documentation

bool operator!= ( const Dimension a,
const Dimension b 
)
friend
Dimension operator+ ( const Dimension a,
const Dimension b 
)
friend
Dimension operator- ( const Dimension a,
const Dimension b 
)
friend
bool operator== ( const Dimension a,
const Dimension b 
)
friend

Member Data Documentation

std::vector<int> psi::Dimension::blocks_
private
std::string psi::Dimension::name_
private

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