VERB_code_2.3
|
one dimensional matrix class More...
#include <Matrix.h>
Public Member Functions | |
Matrix1D (int x_size) | |
Matrix1D (int x_size, string name) | |
Matrix1D (const Matrix1D< T > &M) | |
~Matrix1D () | |
void | AllocateMemory (int x_size) |
T & | operator[] (int i) |
Return the i-th value of matrix. More... | |
T & | operator[] (int i) const |
T & | operator() (int x) |
Return the x-th value of matrix. More... | |
T & | Value (int x) |
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 itself as positive version of values. | |
const Matrix1D | operator- () const |
Return negative version of values. | |
Matrix1D & | operator= (const Matrix1D< T > &M) |
Matrix1D & | operator= (const T val) |
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. More... | |
T | norm () const |
Norm. More... | |
void | Akima_interpolation (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, int extrapolation_type=0, double lb=0, double ub=0) |
void | Akima_interpolation2 (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, int extrapolation_type=0, double lb=0, double ub=0) |
void | Interpolate (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid) |
void | Spline (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, double lb, double ub, double lin_spline_coef=0, double max_second_der=0) |
void | Polint (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid) |
void | Ratint (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid) |
rational | |
void | Polilinear (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, double lb, double ub) |
void | Spline2 (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid, double lb, double ub, double lin_spline_coef=0, double max_second_der=0) |
void | writeToFile (string filename) |
void | writeToFile (string filename, Matrix1D< T > &grid_x) |
void | readFromFile (string filename) |
void | readFromFile (string filename, Matrix1D< T > &grid_x) |
Public Attributes | |
T * | matrix_array |
Array to keep the values. | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_x |
size x | |
string | name |
name of the Matrix | |
one dimensional matrix class
Matrixes and operations.
Constructor.
Runs allocating memory function.
x_size | - size of the matrix |
Definition at line 139 of file Matrix.cpp.
Constructor.
Runs allocating memory function and store matrix name.
x_size | - size of the matrix |
name | - name of the matrix |
Definition at line 123 of file Matrix.cpp.
Constructor.
Make new matrix equal to Matrix M.
&M | - matrix M |
Definition at line 154 of file Matrix.cpp.
Destructor. Destruct the class.
Definition at line 163 of file Matrix.cpp.
void Matrix1D< T >::Akima_interpolation | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
int | extrapolation_type = 0 , |
||
double | lb = 0 , |
||
double | ub = 0 |
||
) |
Akima interpolation
Definition at line 1752 of file Matrix.cpp.
void Matrix1D< T >::Akima_interpolation2 | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
int | extrapolation_type = 0 , |
||
double | lb = 0 , |
||
double | ub = 0 |
||
) |
Akima interpolation - second test version
Definition at line 1868 of file Matrix.cpp.
void Matrix1D< T >::AllocateMemory | ( | int | x_size | ) |
Arraywise division (A./B), stores result in a new matrix.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 324 of file Matrix.cpp.
void Matrix1D< T >::Interpolate | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid | ||
) |
Linear interpolation. Runs interpolation function from Numerical Recepies.
Definition at line 1414 of file Matrix.cpp.
|
inline |
|
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 |
Definition at line 224 of file Matrix.cpp.
Multiply a matrix to a value Val. Return new instance of class Matrix.
Val | - value Val |
Definition at line 282 of file Matrix.cpp.
Divide a matrix to a value Val. Return new instance of class Matrix.
Val | - value Val |
Definition at line 296 of file Matrix.cpp.
Make matrix equal to matrix M Return the same instance of class Matrix.
&M | - matrix M |
Definition at line 241 of file Matrix.cpp.
Make matrix equal to value Val. Return the same instance of class Matrix.
Val | - value val |
Definition at line 269 of file Matrix.cpp.
|
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 |
Definition at line 189 of file Matrix.cpp.
|
inline |
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 |
Definition at line 206 of file Matrix.cpp.
void Matrix1D< T >::Polilinear | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
double | lb, | ||
double | ub | ||
) |
polynomial + linear Some other weird interpolation attempts.
Definition at line 1673 of file Matrix.cpp.
void Matrix1D< T >::Polint | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid | ||
) |
polynomial Some other weird interpolation attempts.
Definition at line 1691 of file Matrix.cpp.
void Matrix1D< T >::readFromFile | ( | string | filename | ) |
Read matrix data from file.
Definition at line 405 of file Matrix.cpp.
Read matrix data from file and check 'grid'
Definition at line 438 of file Matrix.cpp.
void Matrix1D< T >::Spline | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
double | lb, | ||
double | ub, | ||
double | lin_spline_coef = 0 , |
||
double | max_second_der = 0 |
||
) |
Spline interpolation. Runs interpolation functions from Numerical Recipies. Treats boundary conditions separate, i.e. use boundary values on boundary conditions and extrapolation, use linear interpolation for next-to-the-boundary points. Has additional mechanism of smoothening the interpolation - makes it more linear according to the parameters lin_spline_coef and max_second_der. Spline interpolation is linear + additional terms from second derivatives (look Numerical Recipies). If second derivative > max_second_der the second derivatives are multiplied by lin_spline_coef.
&old_function | - old function |
&old_grid | - old grid |
&new_grid | - new grid |
lb | - low boundary value |
ub | - upper boundary value |
lin_spline_coef | - coefficient to multiply the second derivatives terms (makes interpolation more smooth) |
max_second_der | - maximum second derivatives, all greater derivatives gonna be multiplied by lin_spline_coef |
Definition at line 1455 of file Matrix.cpp.
void Matrix1D< T >::Spline2 | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
double | lb, | ||
double | ub, | ||
double | lin_spline_coef = 0 , |
||
double | max_second_der = 0 |
||
) |
Another spline interpolation. An attempt to make it more stable. Runs interpolation functions from Numerical Recepies. Treats boundary conditions separete, i.e. use boundary values on baundary conditions and extrapolation, use linear interpolation for next-to-the-boundary points. Has additional mechenism of smoothning the interpolation - makes it more linear according the parameters lin_spline_coef and max_second_der. Spline interpolation is linear + additional terms from second derivatives (look Numerical Recepies). If second derivative > max_second_der the second derivatives are multiplid by lin_spline_coef.
&old_function | - old function |
&old_grid | - old grid |
&new_grid | - new grid |
lb | - low boundary value |
ub | - upper boundary value |
lin_spline_coef | - coefficient to multiply the second derivatives terms (makes interpolation more smooth) |
max_second_der | - maximum second derivatives, all greater derivatives gonna be multiplied by lin_spline_coef |
Definition at line 1621 of file Matrix.cpp.
Arraywise multiplication (A.*B), stores result in a new matrix.
Multiply all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 310 of file Matrix.cpp.
void Matrix1D< T >::writeToFile | ( | string | filename | ) |
Write matrix data to file.
Definition at line 366 of file Matrix.cpp.
Write matrix data to file with grid.
Definition at line 385 of file Matrix.cpp.