VERB_code_2.2
2
|
#include <Matrix.h>
Public Member Functions | |
Matrix2D () | |
Matrix2D (const Matrix2D< T > &M) | |
Matrix2D (int size_x, int size_y) | |
~Matrix2D () | |
void | AllocateMemory (int size_x, int size_y) |
T * | operator[] (int i) |
Return the i-th pointer to 1d-array. Next [j] can be applied, so we have regular [i][j]. More... | |
T * | operator[] (int i) const |
T & | operator() (int x, int y) |
Return the (x,y)-th value of matrix. More... | |
T & | Value (int x, int y) |
Return the (x,y) value of matrix. More... | |
Matrix2D< T > & | MatrixArray () |
Return pointer to the instance of the class. More... | |
const Matrix2D & | operator+ () const |
const Matrix2D | operator- () const |
Matrix2D & | operator= (const Matrix2D< T > &M) |
Matrix2D & | operator= (const T val) |
Matrix2D | operator* (const T Val) const |
Matrix2D | operator/ (const T Val) const |
Matrix2D | times (const Matrix2D< T > &M) const |
Arraywise multiplication (A.*B), stores result in a new matrix. More... | |
Matrix2D | divide (const Matrix2D< T > &M) const |
Arraywise division (A./B), stores result in a new matrix. More... | |
Matrix2D | max_of (T 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) |
int | index1d (int x, int y) const |
void | writeToFile (string filename) |
void | writeToFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y) |
void | readFromFile (string filename) |
void | readFromFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y) |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. More... | |
int | size_x |
int | size_y |
size x, size_y More... | |
string | name |
name of the Matrix More... | |
Private Attributes | |
T ** | matrix_array |
Matrix 2D class
Matrixes and operations.
Constructor. Create new matrix from the Matrix M.
&M | - Matrix M |
Definition at line 507 of file Matrix.cpp.
Constructor. Allocate memory.
x_size | - x size |
y_size | - y size |
Definition at line 494 of file Matrix.cpp.
Destructor.
Definition at line 516 of file Matrix.cpp.
void Matrix2D< T >::AllocateMemory | ( | int | x_size, |
int | y_size | ||
) |
Allocate memory.
x_size | - x size |
y_size | - y size |
Definition at line 527 of file Matrix.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
Make matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 544 of file Matrix.cpp.
References Matrix2D< T >::initialized, Matrix2D< T >::matrix_array, Matrix2D< T >::name, Matrix2D< T >::size_x, Matrix2D< T >::size_y, and VF::T().
Make matrix equal to value Val.
val | - value Val. |
Definition at line 578 of file Matrix.cpp.
Arraywise multiplication (A.*B), stores result in a new matrix.
Multiply all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 642 of file Matrix.cpp.
Arraywise division (A./B), stores result in a new matrix.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 627 of file Matrix.cpp.
Divide all values of matrix to value Val.
val | - value to divide. |
Definition at line 657 of file Matrix.cpp.
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 | ||
) |
Linear 2D interpolation.
Not sure if it is working.
Definition at line 1900 of file Matrix.cpp.
References Linear2D(), Matrix2D< T >::size_x, and Matrix2D< T >::size_y.
|
inline |
Returns corresponding index of 1d array
Definition at line 670 of file Matrix.cpp.
void Matrix2D< T >::writeToFile | ( | string | filename) |
Writes the matrix to a file. File has two header lines.
filename | - file name |
Definition at line 685 of file Matrix.cpp.
void Matrix2D< T >::writeToFile | ( | string | filename, |
Matrix2D< T > & | grid_x, | ||
Matrix2D< T > & | grid_y | ||
) |
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 708 of file Matrix.cpp.
References Matrix2D< T >::name.
void Matrix2D< T >::readFromFile | ( | string | filename) |
Read matrix data from file.
Definition at line 727 of file Matrix.cpp.
void Matrix2D< T >::readFromFile | ( | string | filename, |
Matrix2D< T > & | grid_x, | ||
Matrix2D< T > & | grid_y | ||
) |
Read matrix data from file and check grid
Definition at line 762 of file Matrix.cpp.
References err.
|
private |
bool Matrix2D< T >::initialized |
int Matrix2D< T >::size_y |
string Matrix2D< T >::name |