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

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

#include <Matrix.h>

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

Public Member Functions

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.

Protected Member Functions

 Matrix ()
 Default constructor.
 ~Matrix ()
 Destructor.

Protected Attributes

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::Matrix< Data >

Two-dimensional array container template (interface).

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 designed to be used as a base class that provides an interface for accessing elements of an array. Memory management is delegated to subclasses.

Definition at line 31 of file Matrix.h.

Constructor & Destructor Documentation

◆ Matrix()

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

Default constructor.

Constructor (protected).

Protected to prevent direct instantiation.

Definition at line 115 of file Matrix.h.

References capacity1_, capacity2_, and data_.

◆ ~Matrix()

template<typename Data>
Util::Matrix< Data >::~Matrix ( )
protected

Destructor.

Protected to prevent direct destruction.

Definition at line 125 of file Matrix.h.

Member Function Documentation

◆ capacity1()

template<typename Data>
int Util::Matrix< Data >::capacity1 ( ) const
inline

◆ capacity2()

template<typename Data>
int Util::Matrix< Data >::capacity2 ( ) const
inline

◆ 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 146 of file Matrix.h.

References capacity1_, capacity2_, and data_.

◆ 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 160 of file Matrix.h.

References capacity1_, capacity2_, and data_.

◆ cArray() [1/2]

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

Return pointer to underlying one-dimensional C array.

Definition at line 174 of file Matrix.h.

References data_.

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

◆ cArray() [2/2]

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

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

Definition at line 181 of file Matrix.h.

References data_.

Member Data Documentation

◆ data_

◆ capacity1_

◆ capacity2_


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