VERB_code_2.2
2
|
#include <Matrix.h>
Public Member Functions | |
Matrix1D () | |
Matrix1D (int size_x) | |
Matrix1D (int x_size, string name) | |
Matrix1D (const Matrix1D< T > &M) | |
~Matrix1D () | |
void | AllocateMemory (int size_x) |
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. More... | |
Matrix1D< T > & | MatrixArray () |
Return pointer to the instance of the class. More... | |
T * | MatrixArrayPointer () |
Return pointer to the instance of the class. More... | |
const Matrix1D & | operator+ () const |
const Matrix1D | operator- () const |
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) |
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. More... | |
bool | initialized |
Flag, equal true if initialized. More... | |
int | size_x |
size x More... | |
string | name |
name of the Matrix More... | |
Matrix 1D class
Matrixes and operations.
Constructor.
Runs allocating memory function.
x_size | - size of the matrix |
Definition at line 142 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 126 of file Matrix.cpp.
Constructor.
Make new matrix equal to Matrix M.
&M | - matrix M |
Definition at line 157 of file Matrix.cpp.
Destructor. Destruct the class.
Definition at line 166 of file Matrix.cpp.
void Matrix1D< T >::AllocateMemory | ( | int | x_size) |
|
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 192 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 209 of file Matrix.cpp.
|
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 227 of file Matrix.cpp.
|
inline |
|
inline |
Make matrix equal to matrix M Return the same instance of class Matrix.
&M | - matrix M |
Definition at line 244 of file Matrix.cpp.
References Matrix1D< T >::initialized, Matrix1D< T >::matrix_array, Matrix1D< T >::name, Matrix1D< T >::size_x, and VF::T().
Make matrix equal to value Val. Return the same instance of class Matrix.
Val | - value val |
Definition at line 272 of file Matrix.cpp.
Multiply a matrix to a value Val. Return new instance of class Matrix.
Val | - value Val |
Definition at line 285 of file Matrix.cpp.
Divide a matrix to a value Val. Return new instance of class Matrix.
Val | - value Val |
Definition at line 299 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 313 of file Matrix.cpp.
References Matrix1D< T >::matrix_array.
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 327 of file Matrix.cpp.
References Matrix1D< T >::matrix_array.
Dot product.
Dot product
Definition at line 352 of file Matrix.cpp.
References Matrix1D< T >::size_x, and VF::T().
|
inline |
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 1755 of file Matrix.cpp.
References akima(), Matrix1D< T >::matrix_array, and Matrix1D< T >::size_x.
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 1871 of file Matrix.cpp.
References akima2(), Matrix1D< T >::matrix_array, and Matrix1D< T >::size_x.
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 1417 of file Matrix.cpp.
References Maths::Interpolation::Linear::getValue(), Matrix1D< T >::matrix_array, and Matrix1D< T >::size_x.
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 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 1458 of file Matrix.cpp.
References Matrix1D< T >::matrix_array, Matrix1D< T >::size_x, spline(), and splint().
void Matrix1D< T >::Polint | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid | ||
) |
polinomial Some other wired interpolation attempts.
Definition at line 1694 of file Matrix.cpp.
References err, Matrix1D< T >::matrix_array, polint(), and Matrix1D< T >::size_x.
void Matrix1D< T >::Ratint | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid | ||
) |
Definition at line 1710 of file Matrix.cpp.
References err, Matrix1D< T >::matrix_array, ratint(), and Matrix1D< T >::size_x.
void Matrix1D< T >::Polilinear | ( | Matrix1D< T > & | old_function, |
Matrix1D< T > & | old_grid, | ||
Matrix1D< T > & | new_grid, | ||
double | lb, | ||
double | ub | ||
) |
polinomial + lin Some other wired interpolation attempts.
Definition at line 1676 of file Matrix.cpp.
References Matrix1D< T >::matrix_array, polilinear(), and Matrix1D< T >::size_x.
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 1624 of file Matrix.cpp.
References Matrix1D< T >::matrix_array, Matrix1D< T >::size_x, spline(), and splint().
void Matrix1D< T >::writeToFile | ( | string | filename) |
Write matrix data to file.
Definition at line 369 of file Matrix.cpp.
Write matrix data to file with grid.
Definition at line 388 of file Matrix.cpp.
References Matrix1D< T >::name.
void Matrix1D< T >::readFromFile | ( | string | filename) |
Read matrix data from file.
Definition at line 408 of file Matrix.cpp.
Read matrix data from file and check 'grid'
Definition at line 441 of file Matrix.cpp.
References err.
T* Matrix1D< T >::matrix_array |
bool Matrix1D< T >::initialized |
string Matrix1D< T >::name |