TridiagonalOperator is used to define differentiating operator for PDE being solved. More...
#include <tridiagonalOperator.hpp>
Public Member Functions | |
Constructors | |
TridiagonalOperator () | |
Default constructor. | |
TridiagonalOperator (unsigned int size) | |
Constructor defining tridiagonal operator filled with zeros. More... | |
TridiagonalOperator (unsigned int size, double low, double mid, double upp) | |
Constructor defining tridiagonal operator. More... | |
TridiagonalOperator (const std::vector< double > &low, const std::vector< double > &mid, const std::vector< double > &upp) | |
Constructor. More... | |
Getters | |
int | size () const |
Return size of tridiagonal matrix. | |
double | low (int) const |
Value of r-th row in low diagonal. More... | |
double | mid (int) const |
Value of r-th row in mid diagonal. More... | |
double | upp (int) const |
Value of r-th row in upp diagonal. More... | |
Setters | |
void | setFirstRow (double, double) |
Set first row. More... | |
void | setMidRow (int, double, double, double) |
Set i-th row. More... | |
void | setMidRows (double, double, double) |
Set middle rows. More... | |
void | setLastRow (double, double) |
Set first row. More... | |
Static Public Member Functions | |
Differential Operators | |
static TridiagonalOperator | DPlus (int n, double h) |
Creates tridiagonal operator representing forward differentiating of function f. More... | |
static TridiagonalOperator | DMinus (int n, double h) |
Creates tridiagonal operator representing backward differentiating of function f. More... | |
static TridiagonalOperator | DZero (int n, double h) |
Creates tridiagonal operator representing central differentiating of function f. More... | |
static TridiagonalOperator | DZero (const std::vector< double > &grid) |
Creates tridiagonal operator representing central differentiating of function f on non-uniform grid. More... | |
static TridiagonalOperator | DPlusMinus (int n, double h) |
Creates tridiagonal operator representing central second differentiating of function f. More... | |
static TridiagonalOperator | DPlusMinus (const std::vector< double > &grid) |
Creates tridiagonal operator representing central second differentiating of function f on non-uniform grid. More... | |
static TridiagonalOperator | I (int n) |
Creates tridiagonal operator representing identity matrix. More... | |
static TridiagonalOperator | I (const std::vector< double > &grid) |
Creates tridiagonal operator representing identity matrix. More... | |
Private Attributes | |
unsigned int | size_ |
Size of matrix. | |
std::vector< double > | low_ |
Lower diagonal. | |
std::vector< double > | mid_ |
Mid diagonal. | |
std::vector< double > | upp_ |
upper diagonal | |
Friends | |
std::ostream & | operator<< (std::ostream &s, const TridiagonalOperator &A) |
Overloading of << operator. More... | |
TridiagonalOperator | operator+ (const TridiagonalOperator &, const TridiagonalOperator &) |
Overloading of + operator. More... | |
TridiagonalOperator | operator- (const TridiagonalOperator &, const TridiagonalOperator &) |
Overloading of - operator. More... | |
TridiagonalOperator | operator* (double, const TridiagonalOperator &) |
Overloading of * operator for TridiagonalOperator and a real number. More... | |
TridiagonalOperator | operator* (const TridiagonalOperator &, double) |
Overloading of * operator for TridiagonalOperator and a real number. More... | |
TridiagonalOperator | operator/ (const TridiagonalOperator &, double) |
Overloading of / operator for TridiagonalOperator and a real number. More... | |
std::vector< double > | operator* (const TridiagonalOperator &, std::vector< double >) |
Overloading of * operator for TridiagonalOperator and a vector of real number. More... | |
Detailed Description
TridiagonalOperator is tridiagonal matrix is a band matrix that has non-zero elements only on the main diagonal, the first diagonal below this, and the first diagonal above the main diagonal.
As a sparse matrix having non-zero elements only on its diagonals it can be represented by three number vectors representing below lower, upper and mid diagonal.
Tridiagonal matrices are convenient way to represent finite different problem. For example, forward difference formula:
can be represent by following matrix:
where first and last row should be properly handled by boundary conditions and .
TridiagonalOperator class encapsulates the logic of tridiagonal matrix and provides simple methods to handle this mathematical objects. More details see [6] [13]
Constructor & Destructor Documentation
|
explicit |
- Parameters
-
size Size of tridiagonal operator
marian::TridiagonalOperator::TridiagonalOperator | ( | unsigned int | size, |
double | low, | ||
double | mid, | ||
double | upp | ||
) |
- Parameters
-
size Size of tridiagonal operator low Numbers hold on lower diagonal mid Numbers hold on mid diagonal upp Numbers hold on upper diagonal
|
inline |
- Parameters
-
low Lower diagonal mid Mid diagonal upp Upper diagonal
Member Function Documentation
|
inlinestatic |
The differential operator discretizes the first derivative with the backward differencing scheme
where
The matrix form is:
- Parameters
-
n Size of matrix h Increment used in differentiating scheme
|
inlinestatic |
The differential operator discretizes the first derivative with the forward differencing scheme
where
The matrix form is:
- Parameters
-
n Size of matrix h Increment used in differentiating scheme
|
inlinestatic |
The differential operator discretizes the second derivative with the central differencing scheme
where
The matrix form is:
- Parameters
-
n Size of matrix h Increment used in differenting scheme
|
inlinestatic |
The differential operator discretizes the second derivative with the central differencing scheme
where
The matrix form is:
- Parameters
-
grid Grid used for discretization (may be non-uniform)
|
inlinestatic |
The differential operator discretizes the first derivative with the central differencing scheme
where
The matrix form is:
- Parameters
-
n Size of matrix h Increment used in differentiating scheme
|
inlinestatic |
The differential operator discretizes the first derivative with the central differencing scheme
where
The matrix form is:
- Parameters
-
grid Grid used for discretization (may be non-uniform)
|
inlinestatic |
Creates tridiagonal operator representing identity matrix. The matrix form is:
- Parameters
-
n Size of matrix
|
inlinestatic |
Creates tridiagonal operator representing identity matrix. The matrix form is:
- Parameters
-
grid Grid used for discretization (may be non-uniform)
double marian::TridiagonalOperator::low | ( | int | r | ) | const |
- Parameters
-
r Number of row
- Returns
- Value of r-th row in low diagonal
double marian::TridiagonalOperator::mid | ( | int | r | ) | const |
- Parameters
-
r Number of row
- Returns
- Value of r-th row in mid diagonal
void marian::TridiagonalOperator::setFirstRow | ( | double | mid, |
double | upp | ||
) |
- Parameters
-
mid Value for mid diagonal in first row upp Value for upp diagonal in first row
void marian::TridiagonalOperator::setLastRow | ( | double | low, |
double | mid | ||
) |
- Parameters
-
low Value for lower diagonal in last row mid Value for mid diagonal in last row
void marian::TridiagonalOperator::setMidRow | ( | int | i, |
double | low, | ||
double | mid, | ||
double | upp | ||
) |
- Parameters
-
i Number of row low Value for lower diagonal in i-th row mid Value for mid diagonal in i-th row upp Value for upper diagonal in i-th row
void marian::TridiagonalOperator::setMidRows | ( | double | low, |
double | mid, | ||
double | upp | ||
) |
- Parameters
-
low Value for lower diagonal (except first and last row) mid Value for mid diagonal (except first and last row) upp Value for upper diagonal (except first and last row)
double marian::TridiagonalOperator::upp | ( | int | r | ) | const |
- Parameters
-
r Number of row
- Returns
- Value of r-th row in upp diagonal
Friends And Related Function Documentation
|
friend |
Operator defines left multiplication of tridiagonal operators and real number
|
friend |
Operator defines right multiplication of tridiagonal operators and real number
|
friend |
- Parameters
-
A Tridiagonal matrix v Vector transformed by tridiagonal matrix A
- Returns
- Vector w, after transformation
|
friend |
Operator defines addition of tridiagonal operators
|
friend |
Operator defines subtraction of tridiagonal operators
|
friend |
Operator defines division of tridiagonal operators by real number
|
friend |
Method allows to print the tridiagonal operator on console.
The documentation for this class was generated from the following files:
- C:/Unix/home/OEM/fdm/src/FDM/tridiagonalOperator.hpp
- C:/Unix/home/OEM/fdm/src/FDM/tridiagonalOperator.cpp