VERB4D
|
A matrix of 4 dimensions that is immutable. More...
#include <Matrix.h>
Public Member Functions | |
Matrix4D () | |
Default constructor. Do nothing. | |
Matrix4D (const Matrix4D< T > &M) | |
Matrix4D (int size_w, int size_x, int size_y, int size_z) | |
~Matrix4D () | |
virtual void | AllocateMemory (int size_w, int size_x, int size_y, int size_z) |
T *** | operator[] (int i) |
Return the i-th pointer to 3d-array. Next [j][k][l] can be applied, so we have regular [i][j][k][l]. More... | |
T *** | operator[] (int i) const |
const function to return the i-th pointer to 3d-array. Next [j][k][l] can be applied, so we have regular [i][j][k][l]. | |
T & | operator() (int w, int x, int y, int z) |
Return the (w,x,y,z) value of matrix. More... | |
T & | Value (int w, int x, int y, int z) |
Return the (w,x,y,z) value of matrix. | |
Matrix4D< T > & | MatrixArray () |
Return pointer to the instance of the class. | |
Matrix4D & | operator= (const Matrix4D< T > &M) |
Matrix4D & | operator= (const T Val) |
const Matrix4D & | operator+ () const |
unary : return the matrix | |
const Matrix4D | operator- () const |
unary : return the matrix with all values multiplied by -1 | |
Matrix4D & | operator+= (const Matrix4D< T > &M) |
Matrix4D & | operator-= (const Matrix4D< T > &M) |
Matrix4D & | operator*= (const T Val) |
Matrix4D & | operator/= (const T Val) |
Matrix4D & | operator+= (const T Val) |
Add Val to each matrix element, stores result in the matrix it's applied to. More... | |
Matrix4D & | operator-= (const T Val) |
Substract Val from each element in this matrix, stores result in the matrix it's applied to. More... | |
Matrix4D & | times_equal (const Matrix4D< T > &M) |
Arraywise multiplication (A.*B), stores result in the matrix it's applied to. More... | |
Matrix4D & | divide_equal (const Matrix4D< T > &M) |
Arraywise division (A./B), stores result in the matrix it's applied to. More... | |
Matrix4D | operator+ (const Matrix4D< T > &M) const |
Matrix4D | operator- (const Matrix4D< T > &M) const |
Matrix4D | operator* (const T Val) const |
Matrix4D | operator/ (const T Val) const |
Matrix4D | times (const Matrix4D< T > &M) const |
Arraywise multiplication (A.*B), stores result in a new matrix. More... | |
Matrix4D | divide (const Matrix4D< 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, Matrix4D< T > &grid_w, Matrix4D< T > &grid_x, Matrix4D< T > &grid_y, Matrix4D< T > &grid_z) |
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 Matrix4D< T > grid_w, const Matrix4D< T > grid_x, const Matrix4D< T > grid_y, const Matrix4D< T > grid_z) |
Load matrix to a file. More... | |
virtual void | writeToMatlabFile (string filename, string info="") |
Save matrix to a file. More... | |
virtual void | writeToMatlabFile (string filename, Matrix4D< T > &grid_w, Matrix4D< T > &grid_x, Matrix4D< T > &grid_y, Matrix4D< T > &grid_z) |
virtual void | readFromMatlabFile (string file, int column=1) |
virtual void | readFromMatlabFile (string filename, const Matrix4D< T > grid_w, const Matrix4D< T > grid_x, const Matrix4D< T > grid_y, const Matrix4D< T > grid_z) |
int | index1d (int w, int x, int y, int z) |
Returns index of the element (x,y,z) in 1d array. More... | |
T | min () |
T | max () |
T | maxabs () |
Matrix4D< T > | abs () |
Matrix3D< T > | wSlice (int p_w) const |
Matrix3D< T > | xSlice (int p_x) const |
Matrix3D< T > | ySlice (int p_y) const |
Matrix3D< T > | zSlice (int p_z) const |
Matrix2D< T > | wxSlice (int p_w, int p_x) const |
Matrix2D< T > | wySlice (int p_w, int p_y) const |
Matrix2D< T > | wzSlice (int p_w, int p_z) const |
Matrix2D< T > | xySlice (int p_x, int p_y) const |
Matrix2D< T > | xzSlice (int p_x, int p_z) const |
Matrix2D< T > | yzSlice (int p_y, int p_z) const |
Matrix1D< T > | wxySlice (int p_w, int p_x, int p_y) const |
Matrix1D< T > | wxzSlice (int p_w, int p_x, int p_z) const |
Matrix1D< T > | wyzSlice (int p_w, int p_y, int p_z) const |
Matrix1D< T > | xyzSlice (int p_x, int p_y, int p_z) const |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_w |
size w | |
int | size_x |
size x | |
int | size_y |
size y | |
int | size_z |
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 4 dimensions that is immutable.
Matrix 4D class
Matrixes and operations.
Constructor. Create matrix equal to Matrix M.
&M | - Matrix M. |
Constructor. Allocate memory.
Return absolute value of the 4d 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 current matrix by the corresponding element of matrix M and return new matrix
Arraywise division (A./B), stores result in the matrix it's applied to.
Divide each element of the current matrix by the corresponding element of matrix M and return this matrix
|
inline |
Returns index of the element (x,y,z) in 1d array.
Returns corresponding index of 4d matrix if represented as a 1d array
w,x,y,z | - index of element in every dimension for the 4d matrix |
T Matrix4D< T >::max | ( | ) |
Return maximum value of the 4d matrix. Default value set to 0
T Matrix4D< T >::maxabs | ( | ) |
Return absolute maximum value of the 4d matrix. Default value set to 0
T Matrix4D< T >::min | ( | ) |
Return minimum value of the 4d matrix. Default value set to 1e99
|
inline |
Return the (w,x,y,z) value of matrix.
Operator (w, x, y, z), returns value of element [w][x][y][z]. If DEBUG_MODE defined, check if matrix has been initialized.
Multiply each element of the matrix by Val, save result to a new matrix.
Multiply each element of the current matrix by Val and return this matrix
Add each element of the matrix by the corresponding element of matrix M and return new matrix
Add each element of the current matrix by the corresponding element in M and return this matrix
Add Val to each matrix element, stores result in the matrix it's applied to.
Add each element of the current matrix by Val and return this matrix
Substract each element of the matrix by the corresponding element of matrix M and return new matrix
Subtract each element of the current matrix by the corresponding element in M and return this matrix
Substract Val from each element in this matrix, stores result in the matrix it's applied to.
Subtract each element of the current matrix by Val and return this matrix
Divide each element of the matrix by Val, save result to a new matrix.
Divide each element of the current matrix by Val and return this matrix
Makes current matrix equal to Matrix M and returns the current matrix
&M | - Matrix M. |
Makes every element in Matrix equal to Val and returns this matrix
|
inline |
Return the i-th pointer to 3d-array. Next [j][k][l] can be applied, so we have regular [i][j][k][l].
Operator [i], returns pointer to 3D array. Next [j][k][l] 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 | w,x,y,z - checks grids data against the file data |
|
virtual |
Function for reading from matlab file in 4-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 4-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 by the corresponding element of matrix M and return new matrix
Arraywise multiplication (A.*B), stores result in the matrix it's applied to.
Multiply each element of the current matrix by the corresponding element of matrix M and return this 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 4 other matrixes as a grid (simply - write all 5 matrixes to the file). File has two header lines.
|
virtual |
Save matrix to a file.
Write matrix to .mat file. Creates a struct for the matrix. Struct has 7 fields in including - arr time size, size1, size2, size3, size4
|
virtual |
Write matrix to file, using 4 other matrixes as a grid (simply - write all 5 matrixes to the file). Uses the createStructMatrix() function to pack all the grid dimensions into seperate variables and then combines these variables into a single matlab structure to save in .mat
Take w-slice of 4d matrix turning it into 3d matrix. squeeze matrix to 3d getting all the data when the w dimension is at index p_w
p_w | - index at which to slice w dimension |
Take wx-slice of 4d matrix turning it into a 2d matrix.
p_w | - index at which to slice w dimension |
p_x | - index at which to slice x dimension |
Take wxy-slice of 4d matrix turning it into a 1d matrix.
p_w | - index at which to slice w dimension |
p_x | - index at which to slice x dimension |
p_y | - index at which to slice y dimension |
Take wxz-slice of 4d matrix turning it into a 1d matrix.
p_w | - index at which to slice w dimension |
p_x | - index at which to slice x dimension |
p_z | - index at which to slice z dimension |
Take wy-slice of 4d matrix turning it into a 2d matrix.
p_w | - index at which to slice w dimension |
p_y | - index at which to slice y dimension |
Take wyz-slice of 4d matrix turning it into a 1d matrix.
p_w | - index at which to slice w dimension |
p_y | - index at which to slice y dimension |
p_z | - index at which to slice z dimension |
Take wz-slice of 4d matrix turning it into a 2d matrix.
p_w | - index at which to slice w dimension |
p_z | - index at which to slice z dimension |
Take x-slice of 4d matrix turining it into 3d matrix. squeeze matrix to 3d getting all the data when the x dimension is at index p_x
p_x | - index at which to slice x dimension |
Take xy-slice of 4d matrix turning it into a 2d matrix.
p_x | - index at which to slice x dimension |
p_y | - index at which to slice y dimension |
Take xyz-slice of 4d 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 |
p_z | - index at which to slice z dimension |
Take xz-slice of 4d matrix turning it into a 2d matrix.
p_x | - index at which to slice x dimension |
p_z | - index at which to slice z dimension |
Take y-slice of 4d matrix turning it into 3d matrix. squeeze matrix to 3d getting all the data when the y dimension is at index p_y
p_y | - index at which to slice y dimension |
Take yz-slice of 4d matrix turning it into a 2d matrix.
p_y | - index at which to slice y dimension |
p_z | - index at which to slice z dimension |
Take z-slice of 4d matrix turning it into 3d matrix. squeeze matrix to 3d getting all the data when the z dimension is at index p_z
p_z | - index at which to slice z dimension |