#include <Matrix.h>
Public Member Functions | |
int | index1d (int x, int y) |
Returns corresponding index of 1d array. | |
Matrix2D () | |
Matrix2D (const Matrix2D< T > &M) | |
Constructor. | |
Matrix2D (int size_x, int size_y) | |
Constructor. | |
~Matrix2D () | |
Destructor. | |
void | AllocateMemory (int size_x, int size_y) |
Allocate memory. | |
T * | operator[] (int i) |
Return the i-th pointer to 1d-array. Next [j] can be applied, so we have regular [i][j]. | |
Matrix2D & | operator= (const Matrix2D< T > &M) |
Return the (x,y)-th value of matrix !! T operator()(int x, int y) { return matrix_array[x*size_y + y]; }. | |
Matrix2D & | operator= (T val) |
Make matrix equal to value Val. | |
Matrix2D | operator/ (T Val) |
Divide matrix to Val. | |
Matrix2D | operator* (T Val) |
Multiply matrix to Val. | |
Matrix2D | operator/ (Matrix2D< T > &M) |
Divide all values of matrix to values of matrix M. | |
Matrix2D | operator* (Matrix2D< T > &M) |
Multiply all values of matrix to values of matrix M. | |
Matrix2D | max (T val) |
Divide all values of matrix to value Val. | |
void | Interpolate (Matrix2D< T > &old_function, Matrix2D< T > &old_grid_x, Matrix2D< T > &old_grid_y, Matrix2D< T > &new_grid_x, Matrix2D< T > &new_grid_y) |
Linear 2D interpolation. | |
void | writeToFile (string filename) |
Writes the matrix to a file. | |
void | writeToFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y) |
Write the matrix to a file using other two matrixes as a grid. | |
void | readFromFile (string filename) |
Read matrix data from file. | |
void | readFromFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y) |
Read matrix data from file and check grid. | |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_x |
int | size_y |
size x, size_y | |
string | name |
name of the Matrix |
Matrixes and operations.
Definition at line 93 of file Matrix.h.
Constructor.
Create new matrix from the Matrix M.
&M | - Matrix M |
Definition at line 465 of file Matrix.cpp.
References Matrix2D< T >::initialized, and Matrix2D< T >::operator=().
Constructor.
Allocate memory.
x_size | - x size | |
y_size | - y size |
Definition at line 452 of file Matrix.cpp.
References Matrix2D< T >::AllocateMemory(), and Matrix2D< T >::initialized.
void Matrix2D< T >::AllocateMemory | ( | int | x_size, | |
int | y_size | |||
) | [inline] |
Allocate memory.
x_size | - x size | |
y_size | - y size |
Definition at line 485 of file Matrix.cpp.
References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Referenced by PSD::Diffusion_pc_alpha(), Matrix2D< T >::Matrix2D(), and Matrix2D< T >::operator=().
int Matrix2D< T >::index1d | ( | int | x, | |
int | y | |||
) | [inline] |
Returns corresponding index of 1d array.
Definition at line 500 of file Matrix.cpp.
References Matrix2D< T >::size_y.
void Matrix2D< T >::Interpolate | ( | Matrix2D< T > & | old_function, | |
Matrix2D< T > & | old_grid_x, | |||
Matrix2D< T > & | old_grid_y, | |||
Matrix2D< T > & | new_grid_x, | |||
Matrix2D< T > & | new_grid_y | |||
) | [inline] |
Linear 2D interpolation.
Not sure if it is working.
Definition at line 1468 of file Matrix.cpp.
References i, Linear2D(), Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Divide all values of matrix to value Val.
val | - value to divide. |
Definition at line 619 of file Matrix.cpp.
References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Multiply all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 604 of file Matrix.cpp.
References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Multiply matrix to Val.
Val | - value Val. |
Definition at line 574 of file Matrix.cpp.
References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 589 of file Matrix.cpp.
References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Divide matrix to Val.
Val | - value Val. |
Definition at line 559 of file Matrix.cpp.
References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Make matrix equal to value Val.
val | - value Val. |
Definition at line 540 of file Matrix.cpp.
References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Return the (x,y)-th value of matrix !! T operator()(int x, int y) { return matrix_array[x*size_y + y]; }.
Make matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 511 of file Matrix.cpp.
References Matrix2D< T >::AllocateMemory(), Matrix2D< T >::initialized, Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
Referenced by Matrix2D< T >::Matrix2D().
T* Matrix2D< T >::operator[] | ( | int | i | ) | [inline] |
void Matrix2D< T >::readFromFile | ( | string | filename, | |
Matrix2D< T > & | grid_x, | |||
Matrix2D< T > & | grid_y | |||
) | [inline] |
Read matrix data from file and check grid.
Definition at line 712 of file Matrix.cpp.
References err, Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
void Matrix2D< T >::readFromFile | ( | string | filename | ) | [inline] |
Read matrix data from file.
Definition at line 677 of file Matrix.cpp.
References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
void Matrix2D< T >::writeToFile | ( | string | filename, | |
Matrix2D< T > & | grid_x, | |||
Matrix2D< T > & | grid_y | |||
) | [inline] |
Write the matrix to a file using other two matrixes as a grid.
Simply that means - write all three matrixes to a file.
Definition at line 659 of file Matrix.cpp.
References Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
void Matrix2D< T >::writeToFile | ( | string | filename | ) | [inline] |
Writes the matrix to a file.
File has two header lines.
filename | - file name |
Definition at line 637 of file Matrix.cpp.
References Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
bool Matrix2D< T >::initialized |
Flag, equal true if initialized.
Definition at line 100 of file Matrix.h.
Referenced by Matrix2D< T >::AllocateMemory(), PSD::Diffusion_pc_alpha(), PSD::LoadInitialValue(), Matrix2D< T >::Matrix2D(), Matrix3D< T >::operator=(), Matrix2D< T >::operator=(), Matrix2D< T >::readFromFile(), and Matrix2D< T >::~Matrix2D().
name of the Matrix
Definition at line 102 of file Matrix.h.
Referenced by Matrix2D< T >::operator=(), BoundaryCondition::Update(), Matrix2D< T >::writeToFile(), Matrix3D< T >::xSlice(), Matrix3D< T >::ySlice(), and Matrix3D< T >::zSlice().
Definition at line 101 of file Matrix.h.
Referenced by Matrix2D< T >::AllocateMemory(), Matrix2D< T >::Interpolate(), Matrix2D< T >::max(), Matrix2D< T >::operator*(), Matrix2D< T >::operator/(), Matrix3D< T >::operator=(), Matrix2D< T >::operator=(), Matrix2D< T >::readFromFile(), and Matrix2D< T >::writeToFile().
size x, size_y
Definition at line 101 of file Matrix.h.
Referenced by Matrix2D< T >::AllocateMemory(), Matrix2D< T >::index1d(), Matrix2D< T >::Interpolate(), Matrix2D< T >::max(), Matrix2D< T >::operator*(), Matrix2D< T >::operator/(), Matrix3D< T >::operator=(), Matrix2D< T >::operator=(), Matrix2D< T >::readFromFile(), and Matrix2D< T >::writeToFile().