jacobi.template
Public Member Functions | Protected Attributes | List of all members
Matrix Class Referenceabstract

#include <getmatrix.h>

Inheritance diagram for Matrix:
BisectInterpolation CRS_Matrix BisectIntDirichlet FEM_Matrix

Public Member Functions

 Matrix (int nrows, int ncols)
 
 Matrix (Matrix const &)=default
 
virtual ~Matrix ()
 
bool isSquare () const
 
int Nrows () const
 
int Ncols () const
 
virtual void Debug () const =0
 
virtual void GetDiag (std::vector< double > &d) const =0
 
const std::vector< double > & GetDiag () const
 
virtual void Mult (std::vector< double > &w, std::vector< double > const &u) const =0
 
virtual void Defect (std::vector< double > &w, std::vector< double > const &f, std::vector< double > const &u) const =0
 
virtual int fetch (int row, int col) const =0
 

Protected Attributes

int _nrows
 number of rows in matrix More...
 
int _ncols
 number of columns in matrix More...
 
std::vector< double > _dd
 diagonal matrix elements More...
 

Detailed Description

Abstract matrix class.

Definition at line 11 of file getmatrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

Matrix::Matrix ( int  nrows,
int  ncols 
)

Constructor for abstract matrix class.

No memory is allocated.

Parameters
[in]nrowsnumber of matrix rows.
[in]ncolsnumber of matrix columns.

Definition at line 17 of file getmatrix.cpp.

◆ Matrix() [2/2]

Matrix::Matrix ( Matrix const &  )
default

◆ ~Matrix()

Matrix::~Matrix ( )
virtual

Destructor.

No memory is allocated.

Definition at line 26 of file getmatrix.cpp.

Member Function Documentation

◆ Debug()

virtual void Matrix::Debug ( ) const
pure virtual

Show the matrix entries.

Implemented in BisectInterpolation, and CRS_Matrix.

◆ Defect()

virtual void Matrix::Defect ( std::vector< double > &  w,
std::vector< double > const &  f,
std::vector< double > const &  u 
) const
pure virtual

Calculates the defect/residuum w := f - K*u.

Parameters
[in,out]wresulting vector (preallocated)
[in]fload vector
[in]uvector

Implemented in BisectInterpolation, and CRS_Matrix.

◆ fetch()

virtual int Matrix::fetch ( int  row,
int  col 
) const
pure virtual

Finds in a CRS matrix the access index for an entry at row row and column col.

Parameters
[in]rowrow index
[in]colcolumn index
Returns
index for element (row, col). If no appropriate entry exists then -1 will be returned.
Warning
assert() stops the function in case that matrix element (row, col) doesn't exist.

Implemented in BisectInterpolation, and CRS_Matrix.

◆ GetDiag() [1/2]

const std::vector<double>& Matrix::GetDiag ( ) const
inline

Extracts the diagonal elements of the matrix.

Returns
d vector of diagonal elements

Definition at line 78 of file getmatrix.h.

◆ GetDiag() [2/2]

virtual void Matrix::GetDiag ( std::vector< double > &  d) const
pure virtual

Extracts the diagonal elements of an inherited matrix.

Parameters
[in,out]d(prellocated) vector of diagonal elements

Implemented in BisectInterpolation, and CRS_Matrix.

◆ isSquare()

bool Matrix::isSquare ( ) const
inline

Checks whether the matrix is a square matrix.

Returns
True iff square matrix.

Definition at line 38 of file getmatrix.h.

◆ Mult()

virtual void Matrix::Mult ( std::vector< double > &  w,
std::vector< double > const &  u 
) const
pure virtual

Performs the matrix-vector product w := K*u.

Parameters
[in,out]wresulting vector (preallocated)
[in]uvector

Implemented in BisectInterpolation, and CRS_Matrix.

◆ Ncols()

int Matrix::Ncols ( ) const
inline

Number of columns in matrix.

Returns
number of columns.

Definition at line 56 of file getmatrix.h.

◆ Nrows()

int Matrix::Nrows ( ) const
inline

Number of rows in matrix.

Returns
number of rows.

Definition at line 47 of file getmatrix.h.

Member Data Documentation

◆ _dd

std::vector<double> Matrix::_dd
mutableprotected

diagonal matrix elements

Definition at line 122 of file getmatrix.h.

◆ _ncols

int Matrix::_ncols
protected

number of columns in matrix

Definition at line 121 of file getmatrix.h.

◆ _nrows

int Matrix::_nrows
protected

number of rows in matrix

Definition at line 120 of file getmatrix.h.


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