small_matrix.cc File Reference

function templates for small_matrix<T>, small_vector<T> and SmallMatrix<T> classes. More...

#include "small_matrix.hpp"

Include dependency graph for small_matrix.cc:

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


Defines

#define SHT_GAMMA(i)   (B ((i)-1, (i)))
#define SHT_DELTA(i)   (B ((i), (i)))

Functions

template<class T>
void sym_Householder_tridiag (small_matrix< T > &A, small_matrix< T > &B)
 Householder tridiagonalization method for symmetric matrices.
template<class T>
bool sym_eig_QR (small_matrix< T > &A, small_matrix< T > &S, int eig_QR_moi, double eig_QR_prec)
 Computes eigenvalues and the corresponding eigenvectors of the matrix A by the QR-method.

Detailed Description

function templates for small_matrix<T>, small_vector<T> and SmallMatrix<T> classes.

This file contains implementations of non-inline functions. If you produce at the compilation more than one object file, you may need to instanciate the classes small_matrix<T>, small_vector<T> and SmallMatrix<T> in one of you module: for ex. for T = double write

#include "small_matrix.cc"
template class small_matrix<double>;
template class small_vector<double>;
template class SmallMatrix<double>;
Besides, you may need to instantiate the functions 'sym_Householder_tridiag' and 'sym_eig_QR':
template void sym_Householder_tridiag<double>
 (
  small_matrix<double> & A,
  small_matrix<double> & B
 );
template bool sym_eig_QR<double>
 (
  small_matrix<double> & A,
  small_matrix<double> & S,
  int eig_QR_moi,
  double eig_QR_prec
 );
(Read the remarks before the declarations of these templates!) Otherwise include both 'small_matrix.hpp' and 'small_matrix.cc' where you use the small-matrix computations.

History: Sep. 16, 2004 - extracted from small_matrix.hpp


Define Documentation

#define SHT_DELTA (  )     (B ((i), (i)))

#define SHT_GAMMA (  )     (B ((i)-1, (i)))


Function Documentation

template<class T>
bool sym_eig_QR ( small_matrix< T > &  A,
small_matrix< T > &  S,
int  eig_QR_moi = 128,
double  eig_QR_prec = 5e-14 
) [inline]

Computes eigenvalues and the corresponding eigenvectors of the matrix A by the QR-method.

The Wilkinson shift strategy is used. Only symmetric matrices are allowed as Wilkinson strategy is implemented only for this case. The matrix 'A' is destroyed, and after the computation it contains an almost diagonal matrix, whose diagonal entries are approximations of the eigenvalues. These entries are ordered in the ascending order. The second argument S contains in its columns the corresponding eigenvectors. The method is iterative and there are two stopping criteria:

Note:
Here, 'T' must be an ordered type, i.e. 'double' or 'float'!

For the numerical stability reasons, we advise to use only 'double'.

Parameters:
[in,out] A The Matrix to solve the eigenproblem for.
[in,out] S Contains the eigenvectors after the call.
[in] eig_QR_moi Maximum number of the iterations to do.
[in] eig_QR_prec The precision to achieve.

template<class T>
void sym_Householder_tridiag ( small_matrix< T > &  A,
small_matrix< T > &  B 
) [inline]

Householder tridiagonalization method for symmetric matrices.

Transforms a given matrix A to the tridiagonal form and saves it in B. After the computation A keeps the back transformation.

Note:
Here, 'T' must be an ordered type, i.e. 'double' or 'float'!
Parameters:
[in,out] A Initially the matrix to tridiagonalize, contains the
transformation after the call.
[in] B For the tridiagonal matrix


Generated on Fri Sep 21 12:33:52 2007 for SG2 by  doxygen 1.5.2