VERB4D
|
A matrix of 1 dimensions that is immutable. More...
#include <Matrix.h>
Public Member Functions | |
Matrix1D (int size_q1, string name="f") | |
Matrix1D (const Matrix1D< T > &M) | |
~Matrix1D () | |
virtual void | AllocateMemory (int size_q1) |
T & | operator[] (int i) |
Return the i-th value of matrix. More... | |
T & | operator[] (int i) const |
const function to return the i-th value of matrix More... | |
T & | operator() (int q1) |
Return the x-th value of matrix. More... | |
T & | Value (int q1) |
Return the (x,y) value of matrix. | |
Matrix1D< T > & | MatrixArray () |
Return pointer to the instance of the class. | |
T * | MatrixArrayPointer () |
Return pointer to the instance of the class. | |
const Matrix1D & | operator+ () const |
Return the matrix. | |
const Matrix1D | operator- () const |
Return the matrix with all values multiplied by -1. | |
Matrix1D & | operator= (const Matrix1D< T > &M) |
Matrix1D & | operator= (const T val) |
Matrix1D & | operator+= (const Matrix1D< T > &M) |
Matrix1D & | operator-= (const Matrix1D< T > &M) |
Matrix1D & | operator*= (const T Val) |
Matrix1D & | operator/= (const T Val) |
Matrix1D & | operator+= (const T Val) |
Add the Val to each matrix element, stores result in the matrix it's applied to. | |
Matrix1D & | operator-= (const T Val) |
Substract the Val from each matrix element, stores result in the matrix it's applied to. | |
Matrix1D | operator* (const T Val) const |
Matrix1D | operator/ (const T Val) const |
Matrix1D | times (const Matrix1D< T > &M) const |
Arraywise multiplication (A.*B), stores result in a new matrix. More... | |
Matrix1D | divide (const Matrix1D< T > &M) const |
Arraywise division (A./B), stores result in a new matrix. More... | |
T | dot (const Matrix1D< T > &M) const |
Dot product. | |
T | norm () const |
Norm. More... | |
virtual void | writeToFile (string filename) |
virtual void | writeToFile (string filename, Matrix1D< T > &grid_q1) |
virtual void | readFromFile (string filename) |
virtual void | readFromFile (string filename, const Matrix1D< T > grid_q1) |
virtual void | readFromMatlabFile (string filename, int columnNumber=1) |
virtual void | readFromMatlabFile (string filename, const Matrix1D< T > grid_q1) |
T | min () |
T | max () |
T | maxabs () |
Matrix1D< T > | abs () |
Public Attributes | |
T * | matrix_array |
Array to keep the values. | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_q1 |
size x | |
string | name |
name of the Matrix | |
A matrix of 1 dimensions that is immutable.
Matrix 1D class
Matrixes and operations.
Constructor.
Runs allocating memory function and store matrix name.
size_q1 | - size of the matrix |
name | - name of the matrix |
Constructor.
Make new matrix equal to Matrix M.
&M | - matrix M |
Return absolute value of the 1d matrix. Changes every element to a positive value with the same magnitude
|
virtual |
Allocating memory
size_q1 | - size x |
Arraywise division (A./B), stores result in a new matrix.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
T Matrix1D< T >::max | ( | ) |
Return maximum value of the 1d matrix. Default value seet to 0
T Matrix1D< T >::maxabs | ( | ) |
Return absolute maximum value of the 1d matrix. Default value set to 0
T Matrix1D< T >::min | ( | ) |
Return minimum value of the 1d matrix. Default value set to 1e99
|
inline |
Norm.
Norm of vector
|
inline |
Return the x-th value of matrix.
Operator (x), returns value of element x. If DEBUG_MODE defined, check if matrix has been initialized. No dofference between [] and () operators for 1d-matrix class.
x | - number of element to return |
Multiply a matrix to a value Val. Return new instance of class Matrix.
Val | - value Val |
Multiplication to a value. Result is stored into applied matrix (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 a matrix to a value Val. Return new instance of class Matrix.#define DEBUG_MODE
Val | - value Val |
Division by a value. Result is stored into applied matrix (left hand side matrix)
Make matrix equal to matrix M Return the same instance of class Matrix.
&M | - matrix M |
Make matrix equal to value Val. Return the same instance of class Matrix.
Val | - value val |
|
inline |
Return the i-th value of matrix.
Operator [i], returns value of element i. If DEBUG_MODE defined, check if matrix has been initialized.
i | - number of element to return |
|
inline |
const function to return the i-th value of matrix
Operator [i], returns value of element i, version returns 'const' value, can not be later modified. If DEBUG_MODE defined, check if matrix has been initialized.
i | - number of element to return |
|
virtual |
Read matrix data 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 |
grid_q1 | - checks grid data against the file data |
|
virtual |
Function for reading from matlab file in 1-dimension 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 1-dimension 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 |
Write matrix data to file.
|
virtual |
Write matrix data to file with grid.