#include <Matrix.h>
Public Member Functions | |
Matrix1D () | |
Default constructor - do nothing. | |
Matrix1D (int size_x) | |
Constructor. | |
Matrix1D (int x_size, string name) | |
Constructor. | |
Matrix1D (const Matrix1D< T > &M) | |
Constructor. | |
~Matrix1D () | |
Destructor. | |
void | AllocateMemory (int size_x) |
Allocating memory. | |
T | max () |
T | maxabs () |
T & | operator[] (int i) |
Return the i-th value of matrix. | |
T & | operator() (int x) |
Return the x-th value of matrix. | |
Matrix1D & | operator= (const Matrix1D< T > &M) |
Make matrix equal to matrix M Return the same instance of class Matrix. | |
Matrix1D & | operator= (T Val) |
Make matrix equal to value Val. | |
Matrix1D | operator/ (T Val) |
Divide a matrix to a value Val. | |
Matrix1D | operator* (T Val) |
Multiply a matrix to a value Val. | |
Matrix1D | operator/ (Matrix1D< T > &M) |
Divide all values of matrix to values of matrix M. | |
Matrix1D | operator* (Matrix1D< T > &M) |
Multiply all values of matrix to values of matrix M. | |
void | Interpolate (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid) |
Linear interpolation. | |
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) |
Spline interpolation. | |
void | Polint (Matrix1D< T > &old_function, Matrix1D< T > &old_grid, Matrix1D< T > &new_grid) |
polinomial Some other wired interpolation attempts. | |
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) |
polinomial + lin Some other wired interpolation attempts. | |
void | writeToFile (string filename) |
Write matrix data to file. | |
void | writeToFile (string filename, Matrix1D< T > &grid_x) |
Write matrix data to file with grid. | |
void | readFromFile (string filename) |
Read matrix data from file. | |
void | readFromFile (string filename, Matrix1D< T > &grid_x) |
Read matrix data from file and check 'grid'. | |
Public Attributes | |
bool | initialized |
Flag, equal true if initialized. | |
int | size_x |
size x | |
string | name |
name of the Matrix |
Matrixes and operations.
Definition at line 38 of file Matrix.h.
Constructor.
Runs allocating memory function.
x_size | - size of the matrix |
Definition at line 136 of file Matrix.cpp.
References Matrix1D< T >::AllocateMemory(), and Matrix1D< T >::initialized.
Constructor.
Runs allocating memory function and store matrix name.
x_size | - size of the matrix | |
name | - name of the matrix |
Definition at line 120 of file Matrix.cpp.
References Matrix1D< T >::AllocateMemory(), and Matrix1D< T >::initialized.
Constructor.
Make new matrix equal to Matrix M.
&M | - matrix M |
Definition at line 151 of file Matrix.cpp.
References Matrix1D< T >::initialized, and Matrix1D< T >::operator=().
Destructor.
Destruct the class.
Definition at line 160 of file Matrix.cpp.
References Matrix1D< T >::initialized.
void Matrix1D< T >::AllocateMemory | ( | int | x_size | ) | [inline] |
Allocating memory.
x_size | - size x |
Definition at line 170 of file Matrix.cpp.
References Matrix1D< T >::initialized, and Matrix1D< T >::size_x.
Referenced by load_1d(), ParamStructure::Load_parameters(), Matrix1D< T >::Matrix1D(), and Matrix1D< T >::operator=().
void Matrix1D< T >::Interpolate | ( | Matrix1D< T > & | old_function, | |
Matrix1D< T > & | old_grid, | |||
Matrix1D< T > & | new_grid | |||
) | [inline] |
Linear interpolation.
Runs interpolation function from Numerical Recepies.
Definition at line 1253 of file Matrix.cpp.
References Maths::Interpolation::Linear::getValue(), i, and Matrix1D< T >::size_x.
Referenced by PSD::Interpolate().
T Matrix1D< T >::max | ( | ) |
T Matrix1D< T >::maxabs | ( | ) |
T & Matrix1D< T >::operator() | ( | int | x | ) | [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 214 of file Matrix.cpp.
References Matrix1D< T >::initialized.
Multiply all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 315 of file Matrix.cpp.
References Matrix1D< T >::size_x.
Multiply a matrix to a value Val.
Return new instance of class Matrix.
Val | - value Val |
Definition at line 287 of file Matrix.cpp.
References Matrix1D< T >::size_x.
Divide all values of matrix to values of matrix M.
&M | - matrix M. |
Definition at line 301 of file Matrix.cpp.
References Matrix1D< T >::size_x.
Divide a matrix to a value Val.
Return new instance of class Matrix.
Val | - value Val |
Definition at line 272 of file Matrix.cpp.
References Matrix1D< T >::size_x.
Make matrix equal to value Val.
Return the same instance of class Matrix.
Val | - value val |
Definition at line 259 of file Matrix.cpp.
References Matrix1D< T >::size_x.
Make matrix equal to matrix M Return the same instance of class Matrix.
&M | - matrix M |
Definition at line 231 of file Matrix.cpp.
References Matrix1D< T >::AllocateMemory(), Matrix1D< T >::initialized, Matrix1D< T >::name, and Matrix1D< T >::size_x.
Referenced by Matrix1D< T >::Matrix1D().
T & Matrix1D< T >::operator[] | ( | int | i | ) | [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 186 of file Matrix.cpp.
References Matrix1D< T >::initialized.
void Matrix1D< T >::Polilinear | ( | Matrix1D< T > & | old_function, | |
Matrix1D< T > & | old_grid, | |||
Matrix1D< T > & | new_grid, | |||
double | lb, | |||
double | ub | |||
) | [inline] |
polinomial + lin Some other wired interpolation attempts.
Definition at line 1395 of file Matrix.cpp.
References i, polilinear(), and Matrix1D< T >::size_x.
Referenced by PSD::Interpolate().
void Matrix1D< T >::Polint | ( | Matrix1D< T > & | old_function, | |
Matrix1D< T > & | old_grid, | |||
Matrix1D< T > & | new_grid | |||
) | [inline] |
polinomial Some other wired interpolation attempts.
Definition at line 1413 of file Matrix.cpp.
References err, i, polint(), and Matrix1D< T >::size_x.
void Matrix1D< T >::Ratint | ( | Matrix1D< T > & | old_function, | |
Matrix1D< T > & | old_grid, | |||
Matrix1D< T > & | new_grid | |||
) | [inline] |
Definition at line 1429 of file Matrix.cpp.
References err, i, ratint(), and Matrix1D< T >::size_x.
void Matrix1D< T >::readFromFile | ( | string | filename, | |
Matrix1D< T > & | grid_x | |||
) | [inline] |
Read matrix data from file and check 'grid'.
Definition at line 399 of file Matrix.cpp.
References err, Matrix1D< T >::initialized, and Matrix1D< T >::size_x.
void Matrix1D< T >::readFromFile | ( | string | filename | ) | [inline] |
Read matrix data from file.
Definition at line 366 of file Matrix.cpp.
References Matrix1D< T >::initialized, 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 | |||
) | [inline] |
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 1294 of file Matrix.cpp.
References i, Matrix1D< T >::size_x, spline(), and splint().
Referenced by PSD::Interpolate().
void Matrix1D< T >::writeToFile | ( | string | filename, | |
Matrix1D< T > & | grid_x | |||
) | [inline] |
Write matrix data to file with grid.
Definition at line 346 of file Matrix.cpp.
References Matrix1D< T >::name, and Matrix1D< T >::size_x.
void Matrix1D< T >::writeToFile | ( | string | filename | ) | [inline] |
Write matrix data to file.
Definition at line 327 of file Matrix.cpp.
References Matrix1D< T >::name, and Matrix1D< T >::size_x.
Referenced by PSD::Diffusion_pc_alpha(), PSD::Load_initial_f(), PSD::Load_initial_f_2d(), and steady_state().
bool Matrix1D< T >::initialized |
Flag, equal true if initialized.
Definition at line 43 of file Matrix.h.
Referenced by Matrix1D< T >::AllocateMemory(), Matrix1D< double >::Matrix1D(), Matrix1D< T >::Matrix1D(), Matrix1D< T >::operator()(), Matrix1D< T >::operator=(), Matrix1D< T >::operator[](), Matrix1D< T >::readFromFile(), and Matrix1D< T >::~Matrix1D().
name of the Matrix
Definition at line 45 of file Matrix.h.
Referenced by Matrix1D< T >::operator=(), and Matrix1D< T >::writeToFile().
size x
Definition at line 44 of file Matrix.h.
Referenced by Matrix1D< T >::AllocateMemory(), Matrix1D< T >::Interpolate(), load_1d(), PSD::Load_initial_f(), Matrix1D< T >::operator*(), Matrix1D< T >::operator/(), Matrix1D< T >::operator=(), Matrix1D< T >::Polilinear(), Matrix1D< T >::Polint(), Matrix1D< T >::Ratint(), Matrix1D< T >::readFromFile(), Matrix1D< T >::Spline(), and Matrix1D< T >::writeToFile().