VERB4D
|
A matrix of 2 dimensions that is immutable. More...
#include <Matrix.h>
Public Member Functions | |
Matrix2D (const Matrix2D< T > &M) | |
Matrix2D (int size_q1, int size_q2) | |
~Matrix2D () | |
virtual void | AllocateMemory (int size_q1, int size_q2) |
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 |
const function to return the i-th pointer to 1d-array. Next [j] can be applied, so we have regular [i][j]. | |
T & | operator() (int q1, int q2) |
Return the (x,y)-th value of matrix. | |
T & | Value (int q1, int q2) |
Return the (x,y) value of matrix. | |
Matrix2D< T > & | MatrixArray () |
Return pointer to the instance of the class. | |
const Matrix2D & | operator+ () const |
unary : return the matrix | |
const Matrix2D | operator- () const |
unary : return the matrix with all values multiplied by -1 | |
Matrix2D & | operator= (const Matrix2D< T > &M) |
Matrix2D & | operator= (const T val) |
Matrix2D & | operator+= (const Matrix2D< T > &M) |
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... | |
int | index1d (int q1, int q2) const |
T | max () |
T | maxabs () |
T | min () |
Matrix2D< T > | abs () |
Matrix2D | max_of (T val) |
virtual void | writeToFile (string filename) |
virtual void | writeToFile (string filename, Matrix2D< T > &grid_q1, Matrix2D< T > &grid_q2) |
virtual void | readFromFile (string filename, int column=1) |
virtual void | readFromFile (string filename, const Matrix2D< T > grid_q1, const Matrix2D< T > grid_q2) |
virtual void | readFromMatlabFile (string filename, int column=1) |
virtual void | readFromMatlabFile (string filename, const Matrix2D< T > grid_q1, const Matrix2D< T > grid_q2) |
Matrix1D< T > | xSlice (int p_q1) const |
Matrix1D< T > | ySlice (int p_q2) const |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_q1 |
size x | |
int | size_q2 |
size_y | |
string | name |
name of the Matrix | |
A matrix of 2 dimensions that is immutable.
Matrix 2D class
Matrixes and operations.
Constructor. Create new matrix from the Matrix M.
&M | - Matrix M |
Constructor. Allocate memory.
size_q1 | - x size |
size_q2 | - y size |
Return absolute value of the 2d matrix. Changes every element to a positive value with the same magnitude
|
virtual |
Allocate memory.
size_q1 | - x size |
size_q2 | - y size |
Arraywise division (A./B), stores result in a new matrix.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
|
inline |
Returns corresponding index of 2d matrix if represented as a 1d array
x,y | - index of element in every dimension for the 2d matrix |
T Matrix2D< T >::max | ( | ) |
Return maximum value of the 2d matrix. Default value seet to 0
Divide all values of matrix to value Val.
val | - value to divide. |
T Matrix2D< T >::maxabs | ( | ) |
Return absolute maximum value of the 2d matrix. Default value set to 0
T Matrix2D< T >::min | ( | ) |
Return minimum value of the 2d matrix. Default value set to 1e99
Multiply matrix to Val.
Val | - value Val. |
Multiplication to a value. Result is stored into the left hand side matrix
Matrix summation, result is stored into applied matrix (left hand side matrix)
Matrix subtraction, result is stored into applied matrix (left hand side matrix)
Divide matrix to Val.
Val | - value Val. |
Make matrix equal to Matrix M.
&M | - Matrix M. |
Make matrix equal to value Val.
val | - value Val. |
|
virtual |
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 |
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 - checks grids data against the file data |
|
virtual |
Function for reading from matlab file in 2-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 2-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 all values of matrix to values of matrix M.
&M | - matrix M. |
|
virtual |
Writes the matrix to a file. File has two header lines.
filename | - file name |
|
virtual |
Write the matrix to a file using other two matrixes as a grid. Simply that means - write all three matrixes to a file.
Make x-slice of 2d matrix = 1d matrix.
Make y-slice of 2d matrix = 1d matrix.