Matrix1D< T > Class Template Reference

Matrix 1D class. More...

#include <Matrix.h>

List of all members.

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.
max ()
maxabs ()
T & operator[] (int i)
 Return the i-th value of matrix.
T & operator() (int x)
 Return the x-th value of matrix.
Matrix1Doperator= (const Matrix1D< T > &M)
 Make matrix equal to matrix M Return the same instance of class Matrix.
Matrix1Doperator= (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


Detailed Description

template<typename T>
class Matrix1D< T >

Matrix 1D class.

Matrixes and operations.

Definition at line 38 of file Matrix.h.


Constructor & Destructor Documentation

template<typename T>
Matrix1D< T >::Matrix1D (  )  [inline]

Default constructor - do nothing.

Definition at line 49 of file Matrix.h.

template<class T >
Matrix1D< T >::Matrix1D ( int  x_size  )  [inline]

Constructor.

Runs allocating memory function.

Parameters:
x_size - size of the matrix

Definition at line 136 of file Matrix.cpp.

References Matrix1D< T >::AllocateMemory(), and Matrix1D< T >::initialized.

Here is the call graph for this function:

template<class T >
Matrix1D< T >::Matrix1D ( int  x_size,
string  name 
) [inline]

Constructor.

Runs allocating memory function and store matrix name.

Parameters:
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.

Here is the call graph for this function:

template<class T>
Matrix1D< T >::Matrix1D ( const Matrix1D< T > &  M  )  [inline]

Constructor.

Make new matrix equal to Matrix M.

Parameters:
&M - matrix M

Definition at line 151 of file Matrix.cpp.

References Matrix1D< T >::initialized, and Matrix1D< T >::operator=().

Here is the call graph for this function:

template<class T >
Matrix1D< T >::~Matrix1D (  )  [inline]

Destructor.

Destruct the class.

Definition at line 160 of file Matrix.cpp.

References Matrix1D< T >::initialized.


Member Function Documentation

template<class T >
void Matrix1D< T >::AllocateMemory ( int  x_size  )  [inline]

Allocating memory.

Parameters:
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=().

Here is the caller graph for this function:

template<class T>
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().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
T Matrix1D< T >::max (  ) 

template<typename T>
T Matrix1D< T >::maxabs (  ) 

template<class T >
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.

Parameters:
x - number of element to return

Definition at line 214 of file Matrix.cpp.

References Matrix1D< T >::initialized.

template<class T>
Matrix1D< T > Matrix1D< T >::operator* ( Matrix1D< T > &  M  )  [inline]

Multiply all values of matrix to values of matrix M.

Parameters:
&M - matrix M.

Definition at line 315 of file Matrix.cpp.

References Matrix1D< T >::size_x.

template<class T>
Matrix1D< T > Matrix1D< T >::operator* ( Val  )  [inline]

Multiply a matrix to a value Val.

Return new instance of class Matrix.

Parameters:
Val - value Val

Definition at line 287 of file Matrix.cpp.

References Matrix1D< T >::size_x.

template<class T>
Matrix1D< T > Matrix1D< T >::operator/ ( Matrix1D< T > &  M  )  [inline]

Divide all values of matrix to values of matrix M.

Parameters:
&M - matrix M.

Definition at line 301 of file Matrix.cpp.

References Matrix1D< T >::size_x.

template<class T>
Matrix1D< T > Matrix1D< T >::operator/ ( Val  )  [inline]

Divide a matrix to a value Val.

Return new instance of class Matrix.

Parameters:
Val - value Val

Definition at line 272 of file Matrix.cpp.

References Matrix1D< T >::size_x.

template<class T>
Matrix1D< T > & Matrix1D< T >::operator= ( Val  )  [inline]

Make matrix equal to value Val.

Return the same instance of class Matrix.

Parameters:
Val - value val

Definition at line 259 of file Matrix.cpp.

References Matrix1D< T >::size_x.

template<class T>
Matrix1D< T > & Matrix1D< T >::operator= ( const Matrix1D< T > &  M  )  [inline]

Make matrix equal to matrix M Return the same instance of class Matrix.

Parameters:
&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().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
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.

Parameters:
i - number of element to return

Definition at line 186 of file Matrix.cpp.

References Matrix1D< T >::initialized.

template<class T>
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().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
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.

Here is the call graph for this function:

template<class T>
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.

Here is the call graph for this function:

template<class T>
void Matrix1D< T >::readFromFile ( string  filename,
Matrix1D< T > &  grid_x 
) [inline]

Read matrix data from file and check 'grid'.

Todo:
All matrix readings change to readFromFile() function

Definition at line 399 of file Matrix.cpp.

References err, Matrix1D< T >::initialized, and Matrix1D< T >::size_x.

template<class T >
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.

template<class T>
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.

Parameters:
&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

Todo:
Check the index of the last argument of the spline interpolation.

Definition at line 1294 of file Matrix.cpp.

References i, Matrix1D< T >::size_x, spline(), and splint().

Referenced by PSD::Interpolate().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
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.

template<class T >
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().

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
bool Matrix1D< T >::initialized

template<typename T>
string Matrix1D< T >::name

name of the Matrix

Definition at line 45 of file Matrix.h.

Referenced by Matrix1D< T >::operator=(), and Matrix1D< T >::writeToFile().

template<typename T>
int Matrix1D< T >::size_x


The documentation for this class was generated from the following files:

Generated on Thu May 27 11:53:19 2010 for VERB_CODE_2.0 by  doxygen 1.5.9