PSCF v1.5.0
Util::DMatrix< Data > Class Template Reference

Dynamically allocated Matrix. More...

#include <DMatrix.h>

Inheritance diagram for Util::DMatrix< Data >:
Util::Matrix< Data >

Public Member Functions

 DMatrix ()
 Constructor.
 DMatrix (DMatrix< Data > const &other)
 Copy constructor.
DMatrix< Data > & operator= (DMatrix< Data > const &other)
 Assignment.
 ~DMatrix ()
 Destructor.
void allocate (int capacity1, int capacity2)
 Allocate memory for a matrix.
void deallocate ()
 Deallocate the underlying memory block.
bool isAllocated () const
 Return true if the DMatrix has been allocated, false otherwise.
template<class Archive>
void serialize (Archive &ar, const unsigned int version)
 Serialize a DMatrix to/from an Archive.
Public Member Functions inherited from Util::Matrix< Data >
int capacity1 () const
 Get number of rows (range of the first array index).
int capacity2 () const
 Get number of columns (range of the second array index).
Data const & operator() (int i, int j) const
 Return element (i,j) of matrix by const reference.
Data & operator() (int i, int j)
 Return element (i,j) of matrix by reference.
Data * cArray ()
 Return pointer to underlying one-dimensional C array.
Data const * cArray () const
 Return pointer to const to underlying one-dimensional C array.

Additional Inherited Members

Protected Member Functions inherited from Util::Matrix< Data >
 Matrix ()
 Default constructor.
 ~Matrix ()
 Destructor.
Protected Attributes inherited from Util::Matrix< Data >
Data * data_
 Pointer to 1D C array of all elements.
int capacity1_
 Number of rows (range of first index).
int capacity2_
 Number of columns (range of first index).

Detailed Description

template<typename Data>
class Util::DMatrix< Data >

Dynamically allocated Matrix.

Definition at line 24 of file DMatrix.h.

Constructor & Destructor Documentation

◆ DMatrix() [1/2]

template<typename Data>
Util::DMatrix< Data >::DMatrix ( )

Constructor.

Definition at line 94 of file DMatrix.h.

Referenced by DMatrix(), and operator=().

◆ DMatrix() [2/2]

template<typename Data>
Util::DMatrix< Data >::DMatrix ( DMatrix< Data > const & other)

◆ ~DMatrix()

template<typename Data>
Util::DMatrix< Data >::~DMatrix ( )

Destructor.

Delete dynamically allocated C array.

Definition at line 156 of file DMatrix.h.

References Util::Matrix< Data >::capacity1_, Util::Matrix< Data >::capacity2_, Util::Matrix< Data >::data_, and Util::Memory::deallocate().

Member Function Documentation

◆ operator=()

template<typename Data>
DMatrix< Data > & Util::DMatrix< Data >::operator= ( DMatrix< Data > const & other)

Assignment.

Exceptions
Exceptionif LHS and RHS dimensions do not match.

Definition at line 121 of file DMatrix.h.

References allocate(), Util::Matrix< Data >::capacity1_, Util::Matrix< Data >::capacity2_, Util::Matrix< Data >::data_, DMatrix(), and UTIL_THROW.

◆ allocate()

template<typename Data>
void Util::DMatrix< Data >::allocate ( int capacity1,
int capacity2 )

◆ deallocate()

template<typename Data>
void Util::DMatrix< Data >::deallocate ( )

Deallocate the underlying memory block.

Exceptions
Exceptionif the DMatrix is not allocated.

Definition at line 188 of file DMatrix.h.

References Util::Matrix< Data >::capacity1_, Util::Matrix< Data >::capacity2_, Util::Matrix< Data >::data_, Util::Memory::deallocate(), isAllocated(), and UTIL_THROW.

◆ isAllocated()

template<typename Data>
bool Util::DMatrix< Data >::isAllocated ( ) const
inline

Return true if the DMatrix has been allocated, false otherwise.

Definition at line 202 of file DMatrix.h.

References Util::Matrix< Data >::data_.

Referenced by deallocate(), and serialize().

◆ serialize()

template<typename Data>
template<class Archive>
void Util::DMatrix< Data >::serialize ( Archive & ar,
const unsigned int version )

Serialize a DMatrix to/from an Archive.

Parameters
ararchive
versionarchive version id

Definition at line 210 of file DMatrix.h.

References allocate(), Util::Matrix< Data >::capacity1(), Util::Matrix< Data >::capacity1_, Util::Matrix< Data >::capacity2(), Util::Matrix< Data >::capacity2_, Util::Matrix< Data >::data_, isAllocated(), and UTIL_THROW.


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