VERB4D
|
A matrix of 3 dimensions that is immutable. More...
#include <Matrix.h>
Public Member Functions | |
Matrix3D () | |
Default constructor. Do nothing. | |
Matrix3D (const Matrix3D< T > &M) | |
Matrix3D (int size_q1, int size_q2, int size_q3) | |
~Matrix3D () | |
virtual void | AllocateMemory (int size_q1, int size_q2, int size_q3) |
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 |
const function to return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k]. | |
T & | operator() (int q1, int q2, int q3) |
Return the (x,y,z) value of matrix. More... | |
T & | Value (int q1, int q2, int q3) |
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 |
unary : return the matrix | |
const Matrix3D | operator- () const |
unary : return the matrix with all values multiplied by -1 | |
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... | |
virtual void | writeToFile (string filename, string info="") |
Save matrix to a file. More... | |
virtual void | writeToFile (string filename, Matrix3D< T > &grid_q1, Matrix3D< T > &grid_q2, Matrix3D< T > &grid_q3) |
Save matrix to a file, including grid. More... | |
virtual void | readFromFile (string filename, int column=1) |
Load matrix from a file. More... | |
virtual void | readFromFile (string filename, const Matrix3D< T > grid_q1, const Matrix3D< T > grid_q2, const Matrix3D< T > grid_q3) |
Load matrix to a file. More... | |
virtual void | readFromMatlabFile (string filename, int column=1) |
virtual void | readFromMatlabFile (string filename, const Matrix3D< T > grid_q1, const Matrix3D< T > grid_q2, const Matrix3D< T > grid_q3) |
int | index1d (int q1, int q2, int q3) |
Returns index of the element (x,y,z) in 1d array. More... | |
T | min () |
T | max () |
T | maxabs () |
Matrix3D< T > | abs () |
Matrix2D< T > | xSlice (int p_q1) const |
Matrix2D< T > | ySlice (int p_q2) const |
Matrix2D< T > | zSlice (int p_q3) const |
Matrix1D< T > | xySlice (int p_i1, int p_i2) const |
Matrix1D< T > | yzSlice (int p_i2, int p_i3) const |
Matrix1D< T > | xzSlice (int p_i1, int p_i3) const |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_q1 |
size x | |
int | size_q2 |
size y | |
int | size_q3 |
size z | |
string | name |
name of the Matrix | |
string | change_ind |
Variables useful for tracking of changes (time of change can be stored here) | |
A matrix of 3 dimensions that is immutable.
Matrix 3D class
Matrixes and operations.
Constructor. Create matrix equal to Matrix M.
&M | - Matrix M. |
Constructor. Allocate memory.
Return absolute value of the 3d matrix. Changes every element to a positive value with the same magnitude
|
virtual |
Allocating memory and filling it with zero-values.
Arraywise division (A./B), stores result in a new matrix.
Divide each element of the matrix to corresponds element of matrix M.
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)
|
inline |
Returns index of the element (x,y,z) in 1d array.
Returns corresponding index of 3d matrix if represented as a 1d array
x,y,z | - index of element in every dimension for the 3d matrix |
T Matrix3D< T >::max | ( | ) |
Return maximum value of the 3d matrix. Default value seet to 0
T Matrix3D< T >::maxabs | ( | ) |
Return absolute maximum value of the 3d matrix. Default value set to 0
T Matrix3D< T >::min | ( | ) |
Return minimum value of the 3d matrix. Default value set to 1e99
|
inline |
Return the (x,y,z) value of matrix.
Operator (x, y, z), returns value of element [i1][i2][i3]. If DEBUG_MODE defined, check if matrix has been initialized.
Multiply each element of the matrix to Val, save result to a new matrix.
Multiplication to a value. Result is stored into applied matrix (left hand side matrix)
Add each element of the matrix to corresponds element of matrix M.
Matrix summation, result is stored into applied matrix (left hand side matrix)
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)
Substract each element of the matrix to corresponds element of matrix M.
Matrix subtraction, result is stored into applied matrix (left hand side matrix)
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)
Divide each element of the matrix to Val, save result to a new matrix.
Division by a value. Result is stored into applied matrix (left hand side matrix)
Makes matrix equal to Matrix M.
&M | - Matrix M. |
Makes 3D matrix from 2D matrix. The 3rd dimension makes equal to 1. Makes Matrix equal to value Val.
|
inline |
Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k].
Operator [i1], returns pointer to 2D array. Next [i2][k] can be applied to return value. If DEBUG_MODE defined, check if matrix has been initialized.
i | - number of element to return |
|
virtual |
Load matrix from a file.
Read matrix data from file with grid, by column
Overloaded readFromFile function
filename | - file to read grids from |
read_column | - read up to this column from file |
|
virtual |
Load matrix to a file.
Read matrix data from file with grid, Checks if the matrix data in the file is the same as the grids that were sent in with error < 1e-8, if not within error range will signal error and exit
Overloaded readFromFile function
filename | - file to read grids from |
grids | x,y,z - checks grids data against the file data |
|
virtual |
Function for reading from matlab file in 3-dimensions Will check the variables, order them in (P, R/L, V, K, Val) format and then set matrix_array to be the variable with the corresponding column number This is the same as the readFromFile() function although only compatible with .mat files instead of .plt or other text files
|
virtual |
Function for reading from matlab file in 3-dimensions Will check the variables in the order they are saved in matlab, thus (P R V K Var) should be the standard The variables will be checked against the input grid parameters in order to make sure the right variables/values are being loaded This is the same as the readFromFile() function although only compatible with .mat files instead of .plt or other text files
Arraywise multiplication (A.*B), stores result in a new matrix.
Multiply each element of the matrix to corresponds element of matrix M.
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)
|
virtual |
Save matrix to a file.
Write matrix to file. File has two header lines.
|
virtual |
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.
Take x-slice of 3d matrix turning it into a 2d matrix.
p_x | - index at which to slice x dimension |
Take xy-slice of 3d matrix turning it into a 1d matrix.
p_x | - index at which to slice x dimension |
p_y | - index at which to slice y dimension |
Take xz-slice of 3d matrix turning it into a 1d matrix.
p_x | - index at which to slice x dimension |
p_z | - index at which to slice z dimension |
Take y-slice of 3d matrix turning it into a 2d matrix.
p_y | - index at which to slice y dimension |
Take yz-slice of 3d matrix turning it into a 1d matrix.
p_y | - index at which to slice y dimension |
p_z | - index at which to slice z dimension |
Take z-slice of 3d matrix turning it into a 2d matrix.
p_z | - index at which to slice z dimension |