VERB_code_2.3
|
two dimensional matrix class More...
#include <Matrix.h>
Public Member Functions | |
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]. | |
T * | operator[] (int i) const |
Return the i-th pointer to 1d-array as const. | |
T & | operator() (int x, int y) |
Return the (x,y)-th value of matrix. | |
T & | Value (int x, int y) |
Return the (x,y) value of matrix. | |
Matrix2D< T > & | MatrixArray () |
Return pointer to the instance of the class. | |
const Matrix2D & | operator+ () const |
Return itself as positive version of values. | |
const Matrix2D | operator- () const |
Return negative version of values. | |
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. | |
string | name |
name of the Matrix | |
int | size_x |
size x, size y | |
int | size_y |
size x, size y | |
two dimensional matrix class
Matrixes and operations.
Constructor. Create new matrix from the Matrix M.
&M | - Matrix M |
Definition at line 504 of file Matrix.cpp.
Constructor. Allocate memory.
x_size | - x size |
y_size | - y size |
Definition at line 491 of file Matrix.cpp.
Destructor.
Definition at line 513 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 524 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 624 of file Matrix.cpp.
|
inline |
Returns corresponding index of 1d array
Definition at line 667 of file Matrix.cpp.
Divide all values of matrix to value Val.
val | - value to divide. |
Definition at line 654 of file Matrix.cpp.
Make matrix equal to value Val.
val | - value Val. |
Definition at line 575 of file Matrix.cpp.
void Matrix2D< T >::readFromFile | ( | string | filename | ) |
Read matrix data from file.
Definition at line 724 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 759 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 639 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 682 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 705 of file Matrix.cpp.