VERB_code_2.2
2
|
#include <Matrix.h>
Public Member Functions | |
Matrix3D () | |
Default constructor. Do nothing. More... | |
Matrix3D (const Matrix3D< T > &M) | |
Matrix3D (int size_x, int size_y, int size_z) | |
~Matrix3D () | |
void | AllocateMemory (int size_x, int size_y, int size_z) |
T ** | operator[] (int i) |
Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k]. More... | |
T ** | operator[] (int i) const |
T & | operator() (int x, int y, int z) |
Return the (x,y,z) value of matrix. More... | |
T & | Value (int x, int y, int z) |
Return the (x,y,z) value of matrix. More... | |
Matrix3D< T > & | MatrixArray () |
Return pointer to the instance of the class. More... | |
Matrix3D & | operator= (const Matrix3D< T > &M) |
Matrix3D & | operator= (const T Val) |
const Matrix3D & | operator+ () const |
const Matrix3D | operator- () const |
Matrix3D & | operator+= (const Matrix3D< T > &M) |
Matrix3D & | operator-= (const Matrix3D< T > &M) |
Matrix3D & | operator*= (const T Val) |
Matrix3D & | operator/= (const T Val) |
Matrix3D & | operator+= (const T Val) |
Add the Val to each matrix element, stores result in the matrix it's applied to. More... | |
Matrix3D & | operator-= (const T Val) |
Substract the Val from each matrix element, stores result in the matrix it's applied to. More... | |
Matrix3D & | times_equal (const Matrix3D< T > &M) |
Arraywise multiplication (A.*B), stores result in the matrix it's applied to. More... | |
Matrix3D & | divide_equal (const Matrix3D< T > &M) |
Arraywise division (A./B), stores result in the matrix it's applied to. More... | |
Matrix3D | operator+ (const Matrix3D< T > &M) const |
Matrix3D | operator- (const Matrix3D< T > &M) const |
Matrix3D | operator* (const T Val) const |
Matrix3D | operator/ (const T Val) const |
Matrix3D | times (const Matrix3D< T > &M) const |
Arraywise multiplication (A.*B), stores result in a new matrix. More... | |
Matrix3D | divide (const Matrix3D< T > &M) const |
Arraywise division (A./B), stores result in a new matrix. More... | |
void | writeToFile (string filename) |
Save matrix to a file. More... | |
void | writeToFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z) |
Save matrix to a file, including grid. More... | |
void | readFromFile (string filename) |
Load matrix from a file. More... | |
void | readFromFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z) |
Load matrix to a file. More... | |
int | index1d (int x, int y, int z) |
Returns index of the element (x,y,z) in 1d array. More... | |
T | max () |
T | maxabs () |
Matrix3D< T > | abs () |
Matrix2D< T > | xSlice (int p_x) const |
Matrix2D< T > | ySlice (int p_y) const |
Matrix2D< T > | zSlice (int p_z) const |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. More... | |
int | size_x |
int | size_y |
int | size_z |
size x, size y, size z More... | |
string | name |
name of the Matrix More... | |
string | change_ind |
Variables useful for tracking of changes (time of change can be stored here) More... | |
Private Attributes | |
T * | plane_array |
Plane array of values. All rows saved in the memory one after anouther as a big array. More... | |
T *** | matrix_array |
Matrix array (array of links to other arrays). Final likns pointed to the memory addresses of the plane array. Matrix[x][y] can be used. More... | |
Matrix 3D class
Matrixes and operations.
Constructor. Create matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 826 of file Matrix.cpp.
Constructor. Allocate memory.
Definition at line 813 of file Matrix.cpp.
Destructor
Definition at line 835 of file Matrix.cpp.
void Matrix3D< T >::AllocateMemory | ( | int | x_size, |
int | y_size, | ||
int | z_size | ||
) |
Allocating memory and filling it with zero-values.
Definition at line 844 of file Matrix.cpp.
|
inline |
Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k].
Operator [i], returns pointer to 2D array. Next [j][k] can be applied to return value. If DEBUG_MODE defined, check if matrix has been initialized.
i | - number of element to return |
Definition at line 867 of file Matrix.cpp.
|
inline |
|
inline |
Return the (x,y,z) value of matrix.
Operator (x, y, z), returns value of element [x][y][z]. If DEBUG_MODE defined, check if matrix has been initialized.
Definition at line 883 of file Matrix.cpp.
|
inline |
Makes matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 902 of file Matrix.cpp.
References Matrix3D< T >::initialized, Matrix3D< T >::matrix_array, Matrix3D< T >::name, Matrix3D< T >::size_x, Matrix3D< T >::size_y, Matrix3D< T >::size_z, and VF::T().
Makes 3D matrix from 2D matrix. The 3rd dimension makes equal to 1. Makes Matrix equal to value Val.
Definition at line 961 of file Matrix.cpp.
Matrix summation, result is stored into applied matrix (left hand side matrix)
Definition at line 975 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Matrix subtraction, result is stored into applied matrix (left hand side matrix)
Definition at line 988 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Multiplication to a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 1001 of file Matrix.cpp.
Division by a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 1014 of file Matrix.cpp.
Add the Val to each matrix element, stores result in the matrix it's applied to.
Summation with a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 1027 of file Matrix.cpp.
Substract the Val from each matrix element, stores result in the matrix it's applied to.
Subtraction of a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 1040 of file Matrix.cpp.
Arraywise multiplication (A.*B), stores result in the matrix it's applied to.
Multiplication between each element of the matrices (not a matrix multiplication). Result is stored into applied matrix (left hand side matrix)
Definition at line 1053 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Arraywise division (A./B), stores result in the matrix it's applied to.
Division of each element of one matrices to the element of another. Result is stored into applied matrix (left hand side matrix)
Definition at line 1066 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Add each element of the matrix to corresponds element of matrix M.
Definition at line 1079 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Substract each element of the matrix to corresponds element of matrix M.
Definition at line 1093 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Multiply each element of the matrix to Val, save result to a new matrix.
Definition at line 1108 of file Matrix.cpp.
Divide each element of the matrix to Val, save result to a new matrix.
Definition at line 1123 of file Matrix.cpp.
Arraywise multiplication (A.*B), stores result in a new matrix.
Multiply each element of the matrix to corresponds element of matrix M.
Definition at line 1137 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
Arraywise division (A./B), stores result in a new matrix.
Divide each element of the matrix to corresponds element of matrix M.
Definition at line 1151 of file Matrix.cpp.
References Matrix3D< T >::matrix_array.
void Matrix3D< T >::writeToFile | ( | string | filename) |
Save matrix to a file.
Write matrix to file. File has two header lines.
Definition at line 1167 of file Matrix.cpp.
void Matrix3D< T >::writeToFile | ( | string | filename, |
Matrix3D< T > & | grid_x, | ||
Matrix3D< T > & | grid_y, | ||
Matrix3D< T > & | grid_z | ||
) |
Save matrix to a file, including grid.
Write matrix to file, using 3 other matrixes as a grid (simply - write all 4 matrixes to the file). File has two header lines.
Definition at line 1188 of file Matrix.cpp.
References Matrix3D< T >::name.
void Matrix3D< T >::readFromFile | ( | string | filename) |
void Matrix3D< T >::readFromFile | ( | string | filename, |
Matrix3D< T > & | grid_x, | ||
Matrix3D< T > & | grid_y, | ||
Matrix3D< T > & | grid_z | ||
) |
Load matrix to a file.
Read matrix data from file with grid
Definition at line 1249 of file Matrix.cpp.
|
inline |
Returns index of the element (x,y,z) in 1d array.
Returns corresponding index of 1d array
Definition at line 1299 of file Matrix.cpp.
T Matrix3D< T >::max | ( | ) |
T Matrix3D< T >::maxabs | ( | ) |
Return absolute maximum value of the matrix.
Definition at line 1325 of file Matrix.cpp.
References VF::T().
Return absolute value of the matrix.
Definition at line 1342 of file Matrix.cpp.
Make x-slice of 3d matrix - 2d matrix.
Definition at line 1360 of file Matrix.cpp.
References Matrix2D< T >::name.
Make y-slice of 3d matrix - 2d matrix.
Definition at line 1376 of file Matrix.cpp.
References Matrix2D< T >::name.
Make z-slice of 3d matrix - 2d matrix.
Definition at line 1392 of file Matrix.cpp.
References Matrix2D< T >::name.
|
private |
|
private |
bool Matrix3D< T >::initialized |
int Matrix3D< T >::size_z |
string Matrix3D< T >::name |
string Matrix3D< T >::change_ind |