/dbfs1/fh22/linux/src/FMMLIB/tools.h File Reference

#include <iostream>
#include <fstream>
#include <math.h>
#include <complex>
#include <sstream>
#include <string>
#include <vector>
#include <limits>
#include <ctime>
#include <tbci/matrix.h>
#include <tbci/vector.h>

Include dependency graph for tools.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cmplx

Functions

template<typename T>
std::string to_str (T t)
template<typename T>
string to_str (T *V, int dim1)
template<typename T>
string to_str (T **M, int dim1, int dim2=-1)
template<typename T>
str2number (std::string s)
std::vector< string > strsplit (string str, string delim=" ")
std::vector< string > readFile (string filename)
int delta (int i, int j)
string timestamp (void)
template<typename T>
TBCI::Matrix< T > readMatrix (string filename)
template<typename T>
TBCI::Vector< T > readVector (string filename)
template<typename T>
min (TBCI::Matrix< T > M)
 returns the minimum value of a matrix
template<typename T>
max (TBCI::Matrix< T > M)
 returns the maximum value of a matrix
template<typename T>
TBCI::Matrix< T > invert (TBCI::Matrix< T > M)
 returns the inverse of the input matrix
template<typename T>
TBCI::Matrix< T > multFrontBack (TBCI::Matrix< T > M, TBCI::Vector< T > v)
 returns a matrix with R(i,j)=M(i,j)*v(i)*v(j)
template<typename T>
TBCI::Matrix< T > multFront (TBCI::Matrix< T > M, TBCI::Vector< T > v)
 returns Matrix with R(i,j)=M(i,j)*v(i)
template<typename T>
TBCI::Matrix< T > real (TBCI::Matrix< complex< T > > M)
template<typename T>
TBCI::Matrix< T > imag (TBCI::Matrix< complex< T > > M)
template<typename T>
TBCI::Matrix< T > arg (TBCI::Matrix< complex< T > > M)
template<typename T>
TBCI::Matrix< T > abs (TBCI::Matrix< complex< T > > M)
template<typename T>
TBCI::Matrix< T > norm (TBCI::Matrix< complex< T > > M)
template<typename T>
T ** Allocate2DArray (int nRows, int nCols)
template<typename T>
void Free2DArray (T **Array, int nRows)
template<typename T>
T *** Allocate3DArray (int n1, int n2, int n3)
template<typename T>
void Free3DArray (T ***Array)
void zgetri_ (int *, cmplx *, int *, int *, cmplx *, int *, int *)
void zgetrf_ (int *, int *, cmplx *, int *, int *, int *)
template<typename T>
void inv_c (T **lhsMat, T **inv, int dim)

Variables

const complex< double > I = complex<double>(0,1.)


Function Documentation

template<typename T>
TBCI::Matrix<T> abs ( TBCI::Matrix< complex< T > >  M  )  [inline]

template<typename T>
T** Allocate2DArray ( int  nRows,
int  nCols 
) [inline]

Definition at line 361 of file tools.h.

template<typename T>
T*** Allocate3DArray ( int  n1,
int  n2,
int  n3 
) [inline]

Definition at line 388 of file tools.h.

template<typename T>
TBCI::Matrix<T> arg ( TBCI::Matrix< complex< T > >  M  )  [inline]

Definition at line 310 of file tools.h.

int delta ( int  i,
int  j 
) [inline]

Definition at line 123 of file tools.h.

template<typename T>
void Free2DArray ( T **  Array,
int  nRows 
) [inline]

Definition at line 374 of file tools.h.

template<typename T>
void Free3DArray ( T ***  Array  )  [inline]

Definition at line 403 of file tools.h.

template<typename T>
TBCI::Matrix<T> imag ( TBCI::Matrix< complex< T > >  M  )  [inline]

template<typename T>
void inv_c ( T **  lhsMat,
T **  inv,
int  dim 
) [inline]

Definition at line 422 of file tools.h.

References cmplx::im, imag(), cmplx::re, real(), zgetrf_(), and zgetri_().

template<typename T>
TBCI::Matrix< T > invert ( TBCI::Matrix< T >  M  )  [inline]

returns the inverse of the input matrix

The plan is to choose the best/fastest method (lu_decomp sometimes does not work). Hopefully it is possible to implement the errorhandler to use gaussj a fallback method if lu_decomp falls over.

Definition at line 235 of file tools.h.

Referenced by Grating2D::calcBoundaryW(), GratingLayer2D::calcBTEpsilon(), GratingLayer2D::calcEpsilon(), GratingLayer2D::calcTBEpsilon(), Grating2D::setSMatrix(), GratingLayer2D::solveEigMat(), and GratingLayer2D::solveHomogeneous().

template<typename T>
T max ( TBCI::Matrix< T >  M  )  [inline]

returns the maximum value of a matrix

Definition at line 217 of file tools.h.

References min().

Referenced by min().

template<typename T>
T min ( TBCI::Matrix< T >  M  )  [inline]

returns the minimum value of a matrix

Definition at line 201 of file tools.h.

References max().

Referenced by max(), and timestamp().

template<typename T>
TBCI::Matrix< T > multFront ( TBCI::Matrix< T >  M,
TBCI::Vector< T >  v 
) [inline]

returns Matrix with R(i,j)=M(i,j)*v(i)

Definition at line 265 of file tools.h.

Referenced by Grating2D::setSMatrix().

template<typename T>
TBCI::Matrix< T > multFrontBack ( TBCI::Matrix< T >  M,
TBCI::Vector< T >  v 
) [inline]

returns a matrix with R(i,j)=M(i,j)*v(i)*v(j)

Parameters:
M input matrix
v diagonal of the Matrix to be multiplied on both sides of M a matrix with elements M(i,j)*v(i)*v(j) !

Definition at line 251 of file tools.h.

Referenced by Grating2D::setSMatrix().

template<typename T>
TBCI::Matrix<T> norm ( TBCI::Matrix< complex< T > >  M  )  [inline]

std::vector<string> readFile ( string  filename  )  [inline]

Definition at line 91 of file tools.h.

Referenced by readMatrix(), and readVector().

template<typename T>
TBCI::Matrix< T > readMatrix ( string  filename  )  [inline]

Definition at line 154 of file tools.h.

References readFile(), and strsplit().

template<typename T>
TBCI::Vector< T > readVector ( string  filename  )  [inline]

Definition at line 186 of file tools.h.

References readFile(), and strsplit().

template<typename T>
TBCI::Matrix<T> real ( TBCI::Matrix< complex< T > >  M  )  [inline]

template<typename T>
T str2number ( std::string  s  )  [inline]

Definition at line 63 of file tools.h.

std::vector<string> strsplit ( string  str,
string  delim = " " 
) [inline]

Definition at line 72 of file tools.h.

Referenced by readMatrix(), and readVector().

string timestamp ( void   )  [inline]

Definition at line 129 of file tools.h.

References min().

template<typename T>
string to_str ( T **  M,
int  dim1,
int  dim2 = -1 
) [inline]

Definition at line 49 of file tools.h.

References real(), and to_str().

template<typename T>
string to_str ( T *  V,
int  dim1 
) [inline]

Definition at line 38 of file tools.h.

References to_str().

template<typename T>
std::string to_str ( t  )  [inline]

Definition at line 28 of file tools.h.

Referenced by to_str().

void zgetrf_ ( int *  ,
int *  ,
cmplx ,
int *  ,
int *  ,
int *   
)

Referenced by inv_c().

void zgetri_ ( int *  ,
cmplx ,
int *  ,
int *  ,
cmplx ,
int *  ,
int *   
)

Referenced by inv_c().


Variable Documentation

const complex<double> I = complex<double>(0,1.)


Generated on Thu May 7 16:28:03 2009 for FMM by  doxygen 1.5.5