PSCF v1.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Util::Matrix< Data > Class Template Reference

Two-dimensional array container template (abstract). More...

#include <Matrix.h>

Inheritance diagram for Util::Matrix< Data >:
Util::DMatrix< double > Util::DMatrix< Type > Util::FMatrix< double, D, D > Util::FMatrix< int, D, D > Util::DMatrix< Data > Util::FMatrix< Data, M, N >

Public Member Functions

virtual ~Matrix ()
 Destructor. More...
 
int capacity1 () const
 Get number of rows (range of the first array index). More...
 
int capacity2 () const
 Get number of columns (range of the second array index). More...
 
Data const & operator() (int i, int j) const
 Return element (i,j) of matrix by const reference. More...
 
Data & operator() (int i, int j)
 Return element (i,j) of matrix by reference. More...
 
Data * cArray ()
 Return pointer to underlying one-dimensional C array. More...
 
Data const * cArray () const
 Return pointer to const to underlying one-dimensional C array. More...
 

Protected Member Functions

 Matrix ()
 Default constructor. More...
 

Protected Attributes

Data * data_
 Pointer to 1D C array of all elements. More...
 
int capacity1_
 Number of rows (range of first index). More...
 
int capacity2_
 Number of columns (range of first index). More...
 

Detailed Description

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

Two-dimensional array container template (abstract).

An Matrix object A is a two-dimensional array in which the operator A(i, j) returns a reference to element in column j of row i.

The memory for a Matrix is stored in a single one-dimensional C array, in which each row is stored as a consecutive block.

Class Matrix is an abstract class because it cannot allocate memory. Concrete subclasses include DMatrix and FMatrix.

Definition at line 31 of file Matrix.h.

Constructor & Destructor Documentation

◆ ~Matrix()

template<typename Data >
Util::Matrix< Data >::~Matrix
virtual

Destructor.

Definition at line 129 of file Matrix.h.

◆ Matrix()

template<typename Data >
Util::Matrix< Data >::Matrix
inlineprotected

Default constructor.

Constructor (protected).

Protected to prevent direct instantiation.

Definition at line 119 of file Matrix.h.

Member Function Documentation

◆ capacity1()

template<typename Data >
int Util::Matrix< Data >::capacity1
inline

Get number of rows (range of the first array index).

Definition at line 136 of file Matrix.h.

Referenced by Util::bcast(), Pscf::LuSolver::computeLU(), Util::recv(), and Util::send().

◆ capacity2()

template<typename Data >
int Util::Matrix< Data >::capacity2
inline

Get number of columns (range of the second array index).

Definition at line 143 of file Matrix.h.

Referenced by Util::bcast(), Pscf::LuSolver::computeLU(), Util::recv(), and Util::send().

◆ operator()() [1/2]

template<typename Data >
Data const & Util::Matrix< Data >::operator() ( int  i,
int  j 
) const
inline

Return element (i,j) of matrix by const reference.

Parameters
irow index.
jcolumn index.

Definition at line 150 of file Matrix.h.

◆ operator()() [2/2]

template<typename Data >
Data & Util::Matrix< Data >::operator() ( int  i,
int  j 
)
inline

Return element (i,j) of matrix by reference.

Parameters
irow index.
jcolumn index.

Definition at line 164 of file Matrix.h.

◆ cArray() [1/2]

template<typename Data >
Data * Util::Matrix< Data >::cArray
inline

Return pointer to underlying one-dimensional C array.

Definition at line 178 of file Matrix.h.

Referenced by Pscf::LuSolver::inverse().

◆ cArray() [2/2]

template<typename Data >
Data const * Util::Matrix< Data >::cArray
inline

Return pointer to const to underlying one-dimensional C array.

Definition at line 185 of file Matrix.h.

Member Data Documentation

◆ data_

template<typename Data >
Data* Util::Matrix< Data >::data_
protected

Pointer to 1D C array of all elements.

Definition at line 84 of file Matrix.h.

Referenced by Util::DMatrix< Data >::DMatrix(), Util::FMatrix< Data, M, N >::FMatrix(), and Util::DMatrix< Data >::operator=().

◆ capacity1_

template<typename Data >
int Util::Matrix< Data >::capacity1_
protected

Number of rows (range of first index).

Definition at line 87 of file Matrix.h.

Referenced by Util::DMatrix< Data >::DMatrix(), Util::FMatrix< Data, M, N >::FMatrix(), and Util::DMatrix< Data >::operator=().

◆ capacity2_

template<typename Data >
int Util::Matrix< Data >::capacity2_
protected

Number of columns (range of first index).

Definition at line 90 of file Matrix.h.

Referenced by Util::DMatrix< Data >::DMatrix(), Util::FMatrix< Data, M, N >::FMatrix(), and Util::DMatrix< Data >::operator=().


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