VERB_code_2.3
|
three dimensional matrix class More...
#include <Matrix.h>
Public Member Functions | |
Matrix3D () | |
Default constructor. Do nothing. | |
Matrix3D (const Matrix3D< T > &M) | |
Matrix3D (int size_x, int size_y, int size_z) | |
Constructor with initializing x y z values. More... | |
~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 |
Return the i-th pointer to 2d-array as 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. | |
Matrix3D< T > & | MatrixArray () |
Return pointer to the instance of the class. | |
Matrix3D & | operator= (const Matrix3D< T > &M) |
Matrix3D & | operator= (const T Val) |
const Matrix3D & | operator+ () const |
Return itself as positive version of values. | |
const Matrix3D | operator- () const |
Return negative version of values. | |
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. | |
string | name |
name of the Matrix | |
string | change_ind |
Variables useful for tracking of changes (time of change can be stored here) | |
int | size_x |
size x, size y, size z | |
int | size_y |
size x, size y, size z | |
int | size_z |
size x, size y, size z | |
three dimensional matrix class
Matrixes and operations.
Constructor. Create matrix equal to Matrix M.
&M | - Matrix M. |
Definition at line 823 of file Matrix.cpp.
Constructor with initializing x y z values.
Constructor. Allocate memory.
Definition at line 810 of file Matrix.cpp.
Destructor
Definition at line 832 of file Matrix.cpp.
Return absolute value of the matrix.
Definition at line 1339 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 841 of file Matrix.cpp.
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 1148 of file Matrix.cpp.
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 1063 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 1296 of file Matrix.cpp.
T Matrix3D< T >::max | ( | ) |
Return maximum value of the matrix.
Definition at line 1305 of file Matrix.cpp.
T Matrix3D< T >::maxabs | ( | ) |
Return absolute maximum value of the matrix.
Definition at line 1322 of file Matrix.cpp.
|
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 880 of file Matrix.cpp.
Multiply each element of the matrix to Val, save result to a new matrix.
Definition at line 1105 of file Matrix.cpp.
Multiplication to a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 998 of file Matrix.cpp.
Add each element of the matrix to corresponds element of matrix M.
Definition at line 1076 of file Matrix.cpp.
Matrix summation, result is stored into applied matrix (left hand side matrix)
Definition at line 972 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 1024 of file Matrix.cpp.
Substract each element of the matrix to corresponds element of matrix M.
Definition at line 1090 of file Matrix.cpp.
Matrix subtraction, result is stored into applied matrix (left hand side matrix)
Definition at line 985 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 1037 of file Matrix.cpp.
Divide each element of the matrix to Val, save result to a new matrix.
Definition at line 1120 of file Matrix.cpp.
Division by a value. Result is stored into applied matrix (left hand side matrix)
Definition at line 1011 of file Matrix.cpp.
Makes 3D matrix from 2D matrix. The 3rd dimension makes equal to 1. Makes Matrix equal to value Val.
Definition at line 958 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 864 of file Matrix.cpp.
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 1246 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 1134 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 1050 of file Matrix.cpp.
void Matrix3D< T >::writeToFile | ( | string | filename | ) |
Save matrix to a file.
Write matrix to file. File has two header lines.
Definition at line 1164 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 1185 of file Matrix.cpp.
Make x-slice of 3d matrix - 2d matrix.
Definition at line 1357 of file Matrix.cpp.
Make y-slice of 3d matrix - 2d matrix.
Definition at line 1373 of file Matrix.cpp.
Make z-slice of 3d matrix - 2d matrix.
Definition at line 1389 of file Matrix.cpp.