VERB_code_2.3
Matrix3D< T > Class Template Reference

three dimensional matrix class More...

#include <Matrix.h>

Public Member Functions

 Matrix3D ()
 Default constructor. Do nothing.
 
 Matrix3D (const Matrix3D< T > &M)
 
 Matrix3D (int size_x, int size_y, int size_z)
 Constructor with initializing x y z values. More...
 
 ~Matrix3D ()
 
void AllocateMemory (int size_x, int size_y, int size_z)
 
T ** operator[] (int i)
 Return the i-th pointer to 2d-array. Next [j][k] can be applied, so we have regular [i][j][k]. More...
 
T ** operator[] (int i) const
 Return the i-th pointer to 2d-array as const.
 
T & operator() (int x, int y, int z)
 Return the (x,y,z) value of matrix. More...
 
T & Value (int x, int y, int z)
 Return the (x,y,z) value of matrix.
 
Matrix3D< T > & MatrixArray ()
 Return pointer to the instance of the class.
 
Matrix3Doperator= (const Matrix3D< T > &M)
 
Matrix3Doperator= (const T Val)
 
const Matrix3Doperator+ () const
 Return itself as positive version of values.
 
const Matrix3D operator- () const
 Return negative version of values.
 
Matrix3Doperator+= (const Matrix3D< T > &M)
 
Matrix3Doperator-= (const Matrix3D< T > &M)
 
Matrix3Doperator*= (const T Val)
 
Matrix3Doperator/= (const T Val)
 
Matrix3Doperator+= (const T Val)
 Add the Val to each matrix element, stores result in the matrix it's applied to. More...
 
Matrix3Doperator-= (const T Val)
 Substract the Val from each matrix element, stores result in the matrix it's applied to. More...
 
Matrix3Dtimes_equal (const Matrix3D< T > &M)
 Arraywise multiplication (A.*B), stores result in the matrix it's applied to. More...
 
Matrix3Ddivide_equal (const Matrix3D< T > &M)
 Arraywise division (A./B), stores result in the matrix it's applied to. More...
 
Matrix3D operator+ (const Matrix3D< T > &M) const
 
Matrix3D operator- (const Matrix3D< T > &M) const
 
Matrix3D operator* (const T Val) const
 
Matrix3D operator/ (const T Val) const
 
Matrix3D times (const Matrix3D< T > &M) const
 Arraywise multiplication (A.*B), stores result in a new matrix. More...
 
Matrix3D divide (const Matrix3D< T > &M) const
 Arraywise division (A./B), stores result in a new matrix. More...
 
void writeToFile (string filename)
 Save matrix to a file. More...
 
void writeToFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z)
 Save matrix to a file, including grid. More...
 
void readFromFile (string filename)
 Load matrix from a file. More...
 
void readFromFile (string filename, Matrix3D< T > &grid_x, Matrix3D< T > &grid_y, Matrix3D< T > &grid_z)
 Load matrix to a file. More...
 
int index1d (int x, int y, int z)
 Returns index of the element (x,y,z) in 1d array. More...
 
max ()
 
maxabs ()
 
Matrix3D< T > abs ()
 
Matrix2D< T > xSlice (int p_x) const
 
Matrix2D< T > ySlice (int p_y) const
 
Matrix2D< T > zSlice (int p_z) const
 

Public Attributes

bool initialized
 Flag, equal true if initialized.
 
string name
 name of the Matrix
 
string change_ind
 Variables useful for tracking of changes (time of change can be stored here)
 
int size_x
 size x, size y, size z
 
int size_y
 size x, size y, size z
 
int size_z
 size x, size y, size z
 

Detailed Description

template<typename T>
class Matrix3D< T >

three dimensional matrix class

Matrixes and operations.

Definition at line 215 of file Matrix.h.

Constructor & Destructor Documentation

template<class T>
Matrix3D< T >::Matrix3D ( const Matrix3D< T > &  M)

Constructor. Create matrix equal to Matrix M.

Parameters
&M- Matrix M.

Definition at line 823 of file Matrix.cpp.

template<class T>
Matrix3D< T >::Matrix3D ( int  x_size,
int  y_size,
int  z_size 
)

Constructor with initializing x y z values.

Constructor. Allocate memory.

Definition at line 810 of file Matrix.cpp.

template<class T >
Matrix3D< T >::~Matrix3D ( )

Destructor

Definition at line 832 of file Matrix.cpp.

Member Function Documentation

template<class T >
Matrix3D< T > Matrix3D< T >::abs ( )

Return absolute value of the matrix.

Definition at line 1339 of file Matrix.cpp.

template<class T >
void Matrix3D< T >::AllocateMemory ( int  x_size,
int  y_size,
int  z_size 
)

Allocating memory and filling it with zero-values.

Definition at line 841 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::divide ( const Matrix3D< T > &  M) const
inline

Arraywise division (A./B), stores result in a new matrix.

Divide each element of the matrix to corresponds element of matrix M.

Definition at line 1148 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::divide_equal ( const Matrix3D< T > &  M)
inline

Arraywise division (A./B), stores result in the matrix it's applied to.

Division of each element of one matrices to the element of another. Result is stored into applied matrix (left hand side matrix)

Definition at line 1063 of file Matrix.cpp.

template<class T >
int Matrix3D< T >::index1d ( int  x,
int  y,
int  z 
)
inline

Returns index of the element (x,y,z) in 1d array.

Returns corresponding index of 1d array

Definition at line 1296 of file Matrix.cpp.

template<class T >
T Matrix3D< T >::max ( )

Return maximum value of the matrix.

Definition at line 1305 of file Matrix.cpp.

template<class T >
T Matrix3D< T >::maxabs ( )

Return absolute maximum value of the matrix.

Definition at line 1322 of file Matrix.cpp.

template<class T >
T & Matrix3D< T >::operator() ( int  x,
int  y,
int  z 
)
inline

Return the (x,y,z) value of matrix.

Operator (x, y, z), returns value of element [x][y][z]. If DEBUG_MODE defined, check if matrix has been initialized.

Definition at line 880 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::operator* ( const T  Val) const
inline

Multiply each element of the matrix to Val, save result to a new matrix.

Definition at line 1105 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator*= ( const T  Val)
inline

Multiplication to a value. Result is stored into applied matrix (left hand side matrix)

Definition at line 998 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::operator+ ( const Matrix3D< T > &  M) const
inline

Add each element of the matrix to corresponds element of matrix M.

Definition at line 1076 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator+= ( const Matrix3D< T > &  M)
inline

Matrix summation, result is stored into applied matrix (left hand side matrix)

Definition at line 972 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator+= ( const T  Val)
inline

Add the Val to each matrix element, stores result in the matrix it's applied to.

Summation with a value. Result is stored into applied matrix (left hand side matrix)

Definition at line 1024 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::operator- ( const Matrix3D< T > &  M) const
inline

Substract each element of the matrix to corresponds element of matrix M.

Definition at line 1090 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator-= ( const Matrix3D< T > &  M)
inline

Matrix subtraction, result is stored into applied matrix (left hand side matrix)

Definition at line 985 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator-= ( const T  Val)
inline

Substract the Val from each matrix element, stores result in the matrix it's applied to.

Subtraction of a value. Result is stored into applied matrix (left hand side matrix)

Definition at line 1037 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::operator/ ( const T  Val) const
inline

Divide each element of the matrix to Val, save result to a new matrix.

Definition at line 1120 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator/= ( const T  Val)
inline

Division by a value. Result is stored into applied matrix (left hand side matrix)

Definition at line 1011 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator= ( const Matrix3D< T > &  M)
inline

Makes matrix equal to Matrix M.

Parameters
&M- Matrix M.

Definition at line 899 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::operator= ( const T  Val)
inline

Makes 3D matrix from 2D matrix. The 3rd dimension makes equal to 1. Makes Matrix equal to value Val.

Definition at line 958 of file Matrix.cpp.

template<class T >
T ** Matrix3D< T >::operator[] ( int  i)
inline

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

Operator [i], returns pointer to 2D array. Next [j][k] can be applied to return value. If DEBUG_MODE defined, check if matrix has been initialized.

Parameters
i- number of element to return

Definition at line 864 of file Matrix.cpp.

template<class T >
void Matrix3D< T >::readFromFile ( string  filename)

Load matrix from a file.

Read matrix data from file.

Definition at line 1208 of file Matrix.cpp.

template<class T>
void Matrix3D< T >::readFromFile ( string  filename,
Matrix3D< T > &  grid_x,
Matrix3D< T > &  grid_y,
Matrix3D< T > &  grid_z 
)

Load matrix to a file.

Read matrix data from file with grid

Definition at line 1246 of file Matrix.cpp.

template<class T>
Matrix3D< T > Matrix3D< T >::times ( const Matrix3D< T > &  M) const
inline

Arraywise multiplication (A.*B), stores result in a new matrix.

Multiply each element of the matrix to corresponds element of matrix M.

Definition at line 1134 of file Matrix.cpp.

template<class T>
Matrix3D< T > & Matrix3D< T >::times_equal ( const Matrix3D< T > &  M)
inline

Arraywise multiplication (A.*B), stores result in the matrix it's applied to.

Multiplication between each element of the matrices (not a matrix multiplication). Result is stored into applied matrix (left hand side matrix)

Definition at line 1050 of file Matrix.cpp.

template<class T >
void Matrix3D< T >::writeToFile ( string  filename)

Save matrix to a file.

Write matrix to file. File has two header lines.

Definition at line 1164 of file Matrix.cpp.

template<class T>
void Matrix3D< T >::writeToFile ( string  filename,
Matrix3D< T > &  grid_x,
Matrix3D< T > &  grid_y,
Matrix3D< T > &  grid_z 
)

Save matrix to a file, including grid.

Write matrix to file, using 3 other matrixes as a grid (simply - write all 4 matrixes to the file). File has two header lines.

Definition at line 1185 of file Matrix.cpp.

template<class T >
Matrix2D< T > Matrix3D< T >::xSlice ( int  p_x) const

Make x-slice of 3d matrix - 2d matrix.

Definition at line 1357 of file Matrix.cpp.

template<class T >
Matrix2D< T > Matrix3D< T >::ySlice ( int  p_y) const

Make y-slice of 3d matrix - 2d matrix.

Definition at line 1373 of file Matrix.cpp.

template<class T >
Matrix2D< T > Matrix3D< T >::zSlice ( int  p_z) const

Make z-slice of 3d matrix - 2d matrix.

Definition at line 1389 of file Matrix.cpp.


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