Matrix2D< T > Class Template Reference

Matrix 2D class. More...

#include <Matrix.h>

List of all members.

Public Member Functions

int index1d (int x, int y)
 Returns corresponding index of 1d array.
 Matrix2D ()
 Matrix2D (const Matrix2D< T > &M)
 Constructor.
 Matrix2D (int size_x, int size_y)
 Constructor.
 ~Matrix2D ()
 Destructor.
void AllocateMemory (int size_x, int size_y)
 Allocate memory.
T * operator[] (int i)
 Return the i-th pointer to 1d-array. Next [j] can be applied, so we have regular [i][j].
Matrix2Doperator= (const Matrix2D< T > &M)
 Return the (x,y)-th value of matrix !! T operator()(int x, int y) { return matrix_array[x*size_y + y]; }.
Matrix2Doperator= (T val)
 Make matrix equal to value Val.
Matrix2D operator/ (T Val)
 Divide matrix to Val.
Matrix2D operator* (T Val)
 Multiply matrix to Val.
Matrix2D operator/ (Matrix2D< T > &M)
 Divide all values of matrix to values of matrix M.
Matrix2D operator* (Matrix2D< T > &M)
 Multiply all values of matrix to values of matrix M.
Matrix2D max (T val)
 Divide all values of matrix to value Val.
void Interpolate (Matrix2D< T > &old_function, Matrix2D< T > &old_grid_x, Matrix2D< T > &old_grid_y, Matrix2D< T > &new_grid_x, Matrix2D< T > &new_grid_y)
 Linear 2D interpolation.
void writeToFile (string filename)
 Writes the matrix to a file.
void writeToFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y)
 Write the matrix to a file using other two matrixes as a grid.
void readFromFile (string filename)
 Read matrix data from file.
void readFromFile (string filename, Matrix2D< T > &grid_x, Matrix2D< T > &grid_y)
 Read matrix data from file and check grid.

Public Attributes

bool initialized
 Flag, equal true if initialized.
int size_x
int size_y
 size x, size_y
string name
 name of the Matrix


Detailed Description

template<typename T>
class Matrix2D< T >

Matrix 2D class.

Matrixes and operations.

Definition at line 93 of file Matrix.h.


Constructor & Destructor Documentation

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

Definition at line 108 of file Matrix.h.

References Matrix2D< T >::initialized.

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

Constructor.

Create new matrix from the Matrix M.

Parameters:
&M - Matrix M

Definition at line 465 of file Matrix.cpp.

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

Here is the call graph for this function:

template<class T >
Matrix2D< T >::Matrix2D ( int  x_size,
int  y_size 
) [inline]

Constructor.

Allocate memory.

Parameters:
x_size - x size
y_size - y size

Definition at line 452 of file Matrix.cpp.

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

Here is the call graph for this function:

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

Destructor.

Definition at line 474 of file Matrix.cpp.

References Matrix2D< T >::initialized.


Member Function Documentation

template<class T >
void Matrix2D< T >::AllocateMemory ( int  x_size,
int  y_size 
) [inline]

Allocate memory.

Parameters:
x_size - x size
y_size - y size

Definition at line 485 of file Matrix.cpp.

References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

Referenced by PSD::Diffusion_pc_alpha(), Matrix2D< T >::Matrix2D(), and Matrix2D< T >::operator=().

Here is the caller graph for this function:

template<class T >
int Matrix2D< T >::index1d ( int  x,
int  y 
) [inline]

Returns corresponding index of 1d array.

Definition at line 500 of file Matrix.cpp.

References Matrix2D< T >::size_y.

template<class T >
void Matrix2D< T >::Interpolate ( Matrix2D< T > &  old_function,
Matrix2D< T > &  old_grid_x,
Matrix2D< T > &  old_grid_y,
Matrix2D< T > &  new_grid_x,
Matrix2D< T > &  new_grid_y 
) [inline]

Linear 2D interpolation.

Not sure if it is working.

Definition at line 1468 of file Matrix.cpp.

References i, Linear2D(), Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

Here is the call graph for this function:

template<class T >
Matrix2D< T > Matrix2D< T >::max ( val  )  [inline]

Divide all values of matrix to value Val.

Parameters:
val - value to divide.

Definition at line 619 of file Matrix.cpp.

References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

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

Multiply all values of matrix to values of matrix M.

Parameters:
&M - matrix M.

Definition at line 604 of file Matrix.cpp.

References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

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

Multiply matrix to Val.

Parameters:
Val - value Val.

Definition at line 574 of file Matrix.cpp.

References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

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

Divide all values of matrix to values of matrix M.

Parameters:
&M - matrix M.

Definition at line 589 of file Matrix.cpp.

References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

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

Divide matrix to Val.

Parameters:
Val - value Val.

Definition at line 559 of file Matrix.cpp.

References Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

template<class T >
Matrix2D< T > & Matrix2D< T >::operator= ( val  )  [inline]

Make matrix equal to value Val.

Parameters:
val - value Val.

Definition at line 540 of file Matrix.cpp.

References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

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

Return the (x,y)-th value of matrix !! T operator()(int x, int y) { return matrix_array[x*size_y + y]; }.

Make matrix equal to Matrix M.

Parameters:
&M - Matrix M.

Definition at line 511 of file Matrix.cpp.

References Matrix2D< T >::AllocateMemory(), Matrix2D< T >::initialized, Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

Referenced by Matrix2D< T >::Matrix2D().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T>
T* Matrix2D< T >::operator[] ( int  i  )  [inline]

Return the i-th pointer to 1d-array. Next [j] can be applied, so we have regular [i][j].

Definition at line 117 of file Matrix.h.

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

Read matrix data from file and check grid.

Definition at line 712 of file Matrix.cpp.

References err, Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

template<class T >
void Matrix2D< T >::readFromFile ( string  filename  )  [inline]

Read matrix data from file.

Definition at line 677 of file Matrix.cpp.

References Matrix2D< T >::initialized, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

template<class T >
void Matrix2D< T >::writeToFile ( string  filename,
Matrix2D< T > &  grid_x,
Matrix2D< T > &  grid_y 
) [inline]

Write the matrix to a file using other two matrixes as a grid.

Simply that means - write all three matrixes to a file.

Definition at line 659 of file Matrix.cpp.

References Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.

template<class T >
void Matrix2D< T >::writeToFile ( string  filename  )  [inline]

Writes the matrix to a file.

File has two header lines.

Todo:
Change the name 'writeToFile' in Matrix classes to 'write' or something.
Parameters:
filename - file name

Definition at line 637 of file Matrix.cpp.

References Matrix2D< T >::name, Matrix2D< T >::size_x, and Matrix2D< T >::size_y.


Member Data Documentation

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

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

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

template<typename T>
int Matrix2D< T >::size_y


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