Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

RazorBack::Rsymdiag_ Class Reference

Class Rsymdiag_: an object from this class can be initialised with a real symmetric matrix and its methods allow various diagonalisation tasks to be carried out, such as eigenvalues only, all eigenvalues and eigenvectors, all eigenvalues/some eigenvectors, and selected eigenvalue/eigenvector pairs. More...

#include <Rsymdiag.hh>

List of all members.

Public Methods

 Rsymdiag_ ()
 Inits to an empty object.

 Rsymdiag_ (const Smatdbl_ &Mat)
 Inits to diagonalise Mat.

size_t re_init (const Smatdbl_ &Mat)
 re_init(Mat): reinitialises the calling object with the real symmetric matrix Mat. More...

size_t size () const
 Returns the size of the matrix being diagonalised.

int all_evalevec (Vecdbl_ &Eval, Rmatdbl_ &Evec, bool Sortevals=true)
 all_evalevec(Eval, Evec, Sortevals): Produces all eigenvalues in Eval and the eigenvectors in Evec (columns). More...

int all_eval (Vecdbl_ &Eval, bool Sortevals=true)
 all_eval(Eval, Sortevals): Produces all eigenvalues in Eval (size adjusted silently). More...

int range_evalevec (double Low, double Up, Vecdbl_ &Eval, Rmatdbl_ &Evec, bool Descend=false)
 range_evalevec(Low, Up, Eval, Evec): Finds all eigenvalues within the range [Low, Up], and puts them into Eval in ascending order by default, or in descending order if Descend==true. More...

int range_eval (double Low, double Up, Vecdbl_ &Eval, bool Descend=false)
 range_eval(Low, Up, Eval, Descent): Finds all eigenvalues within the range [Low, Up], and puts them into Eval in ascending order by default or in descending order if Descend==true. More...

int largest_evalevec (size_t N, Vecdbl_ &Eval, Rmatdbl_ &Evec, bool Descend=false)
 largest_evalevec(N, Eval, Evec, Descend): calculates the N largest eigenvalues and the corresponding eigenvectors. More...

int largest_eval (size_t N, Vecdbl_ &Eval, bool Descend=false)
 largest_eval(N, Eval, Descend): calculates the N largest eigenvalues. More...

int evalevec_above (double Thr, Vecdbl_ &Eval, Rmatdbl_ &Evec, bool Descend=false)
 evalevec_above(Thr, Eval, Evec, Descend): calculates the largest eigenvalues and the corresponding eigenvectors above the threshold Thr. More...

int eval_above (double Thr, Vecdbl_ &Eval, bool Descend=false)
 eval_above(Thr, Eval, Descend): calculates the largest eigenvalues above the threshold Thr. More...

void gershgorin_limits (double &Low, double &Up)
 gershgorin_limits(Low, Up): calculates the limits of the range [Low,Up] that contains all eigenvalues of the input matrix. More...


Protected Methods

void housholder_tridiag (bool Wantevec)
int implicit_ql (int Itno, bool Wantevec)
void largest_range (size_t N, double &Low, double &Up)
size_t sturm_seq (double X) const
double sturm_newton (double X) const
void bisect_evals (list< Evaloc_ > &Evalist, list< Evaloc_ >::iterator Iv)
int inverse_iter (double Eval, Vecdbl_ &Evec, double &Tol)
void inverse_iter (double Eval, size_t Multiple, Rmatdbl_ &Evecs)
int tridiag_decomp (const Vecdbl_ &Diagshift)
void tridiag_solve (const Vecdbl_ &Rhs, Vecdbl_ &X) const

Static Protected Methods

void gram_schmidt (Rmatdbl_ &Mat)
double subspace_diff (const Rmatdbl_ &V, const Rmatdbl_ &W)
void random_vector (Vecdbl_ &Vec)
void random_matrix (Rmatdbl_ &Mat)
double round_tozero (double X)

Private Attributes

size_t Size
 size of the matrices (problem dimension).

Rmatdbl_ Q
 Householder transformation matrix.

Vecdbl_ Diag
Vecdbl_ Subdiag
 tridiagonalised matrix.

Vecdbl_ Beta
Vecdbl_ Gamma
 decomposition vectors for inverse iteration.

bool Tridiagdone
 flag to indicate if tridiagonalisation is done.

bool Qdone
 transformation matrix for eigenvectors is done.

bool QLdone
 QL done (destructive!).


Static Private Attributes

const Fparch_<double> Fpdbl
 double-prec arithmetics mach constants.

const Fparch_<float> Fpflo
 single-prec arithmetics mach constants.

const double EPSILON
 error tolerance.


Friends

struct Evaloc_


Detailed Description

Class Rsymdiag_: an object from this class can be initialised with a real symmetric matrix and its methods allow various diagonalisation tasks to be carried out, such as eigenvalues only, all eigenvalues and eigenvectors, all eigenvalues/some eigenvectors, and selected eigenvalue/eigenvector pairs.

Definition at line 46 of file Rsymdiag.hh.


Constructor & Destructor Documentation

RazorBack::Rsymdiag_::Rsymdiag_ ( ) [inline]
 

Inits to an empty object.

Definition at line 114 of file Rsymdiag.hh.

RazorBack::Rsymdiag_::Rsymdiag_ ( const Smatdbl_ & Mat ) [inline, explicit]
 

Inits to diagonalise Mat.

Definition at line 117 of file Rsymdiag.hh.


Member Function Documentation

size_t RazorBack::Rsymdiag_::re_init ( const Smatdbl_ & Mat )
 

re_init(Mat): reinitialises the calling object with the real symmetric matrix Mat.

Returns the size.

Referenced by Rsymdiag_().

size_t RazorBack::Rsymdiag_::size ( ) const [inline]
 

Returns the size of the matrix being diagonalised.

Definition at line 127 of file Rsymdiag.hh.

int RazorBack::Rsymdiag_::all_evalevec ( Vecdbl_ & Eval,
Rmatdbl_ & Evec,
bool Sortevals = true )
 

all_evalevec(Eval, Evec, Sortevals): Produces all eigenvalues in Eval and the eigenvectors in Evec (columns).

The sizes of these are adjusted silently if necessary. if Sortevals is true (the default) then eigenvalues (and the corresponding eigenvectors) are sorted in decreasing order. Return value: no. of dimensions. Throws Rsymdiagexc_ if the calling object was not re-initialised or if the iteration no. was exceeded in the implicit QL step.

int RazorBack::Rsymdiag_::all_eval ( Vecdbl_ & Eval,
bool Sortevals = true )
 

all_eval(Eval, Sortevals): Produces all eigenvalues in Eval (size adjusted silently).

if Sortevals is true (the default) then the eigenvalues are sorted in decreasing order. Return value: no. of dimensions. Throws Rsymdiagexc_ if the calling object was not re-initialised or if the iteration no. was exceeded in the implicit QL step.

int RazorBack::Rsymdiag_::range_evalevec ( double Low,
double Up,
Vecdbl_ & Eval,
Rmatdbl_ & Evec,
bool Descend = false )
 

range_evalevec(Low, Up, Eval, Evec): Finds all eigenvalues within the range [Low, Up], and puts them into Eval in ascending order by default, or in descending order if Descend==true.

The corresponding eigenvectors are put into the columns of Evec. Return value: the number of eigenvalues found. Throws Rsymdiagexc_ if a reinit is needed.

int RazorBack::Rsymdiag_::range_eval ( double Low,
double Up,
Vecdbl_ & Eval,
bool Descend = false )
 

range_eval(Low, Up, Eval, Descent): Finds all eigenvalues within the range [Low, Up], and puts them into Eval in ascending order by default or in descending order if Descend==true.

Return value: the number of eigenvalues found, or -1 if reinit is needed.

int RazorBack::Rsymdiag_::largest_evalevec ( size_t N,
Vecdbl_ & Eval,
Rmatdbl_ & Evec,
bool Descend = false )
 

largest_evalevec(N, Eval, Evec, Descend): calculates the N largest eigenvalues and the corresponding eigenvectors.

Returns the number of eigenvalues found. Throws Argexc_ if N is not in the range [1..size()]. Throws Rsymdiagexc_ if a reinit is needed. See range_evalevec(..) for a description of the other variables.

int RazorBack::Rsymdiag_::largest_eval ( size_t N,
Vecdbl_ & Eval,
bool Descend = false )
 

largest_eval(N, Eval, Descend): calculates the N largest eigenvalues.

Returns the number of eigenvalues found. Throws Argexc_ if N is not in the range [1..size()]. Throws Rsymdiagexc_ if a reinit is needed. See range_eval(..) for a description of the other variables.

int RazorBack::Rsymdiag_::evalevec_above ( double Thr,
Vecdbl_ & Eval,
Rmatdbl_ & Evec,
bool Descend = false )
 

evalevec_above(Thr, Eval, Evec, Descend): calculates the largest eigenvalues and the corresponding eigenvectors above the threshold Thr.

Use for getting all positive eigenvalues for example. Returns the number of eigenvalues found. This can be 0 if Thr is set too high. Throws Rsymdiagexc_ if a reinit is needed. See range_evalevec(..) for a description of the other variables.

int RazorBack::Rsymdiag_::eval_above ( double Thr,
Vecdbl_ & Eval,
bool Descend = false )
 

eval_above(Thr, Eval, Descend): calculates the largest eigenvalues above the threshold Thr.

Use for getting all positive eigenvalues for example. Returns the number of eigenvalues found. This can be 0 if Thr is set too high. Throws Rsymdiagexc_ if a reinit is needed. See range_eval(..) for a description of the other variables.

void RazorBack::Rsymdiag_::gershgorin_limits ( double & Low,
double & Up )
 

gershgorin_limits(Low, Up): calculates the limits of the range [Low,Up] that contains all eigenvalues of the input matrix.

Note that this method performs a Housholder tridiagonalisation but the transform matrix is not accumulated, you would not get eigenvectors without calling re_init(..) after calling this.

void RazorBack::Rsymdiag_::housholder_tridiag ( bool Wantevec ) [protected]
 

int RazorBack::Rsymdiag_::implicit_ql ( int Itno,
bool Wantevec ) [protected]
 

void RazorBack::Rsymdiag_::largest_range ( size_t N,
double & Low,
double & Up ) [protected]
 

size_t RazorBack::Rsymdiag_::sturm_seq ( double X ) const [protected]
 

double RazorBack::Rsymdiag_::sturm_newton ( double X ) const [protected]
 

void RazorBack::Rsymdiag_::bisect_evals ( list< Evaloc_ > & Evalist,
list< Evaloc_ >::iterator Iv ) [protected]
 

int RazorBack::Rsymdiag_::inverse_iter ( double Eval,
Vecdbl_ & Evec,
double & Tol ) [protected]
 

void RazorBack::Rsymdiag_::inverse_iter ( double Eval,
size_t Multiple,
Rmatdbl_ & Evecs ) [protected]
 

void RazorBack::Rsymdiag_::gram_schmidt ( Rmatdbl_ & Mat ) [static, protected]
 

double RazorBack::Rsymdiag_::subspace_diff ( const Rmatdbl_ & V,
const Rmatdbl_ & W ) [static, protected]
 

int RazorBack::Rsymdiag_::tridiag_decomp ( const Vecdbl_ & Diagshift ) [protected]
 

void RazorBack::Rsymdiag_::tridiag_solve ( const Vecdbl_ & Rhs,
Vecdbl_ & X ) const [protected]
 

void RazorBack::Rsymdiag_::random_vector ( Vecdbl_ & Vec ) [static, protected]
 

void RazorBack::Rsymdiag_::random_matrix ( Rmatdbl_ & Mat ) [static, protected]
 

double RazorBack::Rsymdiag_::round_tozero ( double X ) [inline, static, protected]
 

Definition at line 258 of file Rsymdiag.hh.


Friends And Related Function Documentation

friend struct Evaloc_ [friend]
 

Definition at line 72 of file Rsymdiag.hh.


Member Data Documentation

const Fparch_<double> RazorBack::Rsymdiag_::Fpdbl [static, private]
 

double-prec arithmetics mach constants.

Definition at line 51 of file Rsymdiag.hh.

const Fparch_<float> RazorBack::Rsymdiag_::Fpflo [static, private]
 

single-prec arithmetics mach constants.

Definition at line 52 of file Rsymdiag.hh.

const double RazorBack::Rsymdiag_::EPSILON [static, private]
 

error tolerance.

Definition at line 53 of file Rsymdiag.hh.

size_t RazorBack::Rsymdiag_::Size [private]
 

size of the matrices (problem dimension).

Definition at line 102 of file Rsymdiag.hh.

Rmatdbl_ RazorBack::Rsymdiag_::Q [private]
 

Householder transformation matrix.

Definition at line 103 of file Rsymdiag.hh.

Vecdbl_ RazorBack::Rsymdiag_::Diag [private]
 

Definition at line 104 of file Rsymdiag.hh.

Vecdbl_ RazorBack::Rsymdiag_::Subdiag [private]
 

tridiagonalised matrix.

Definition at line 104 of file Rsymdiag.hh.

Vecdbl_ RazorBack::Rsymdiag_::Beta [private]
 

Definition at line 105 of file Rsymdiag.hh.

Vecdbl_ RazorBack::Rsymdiag_::Gamma [private]
 

decomposition vectors for inverse iteration.

Definition at line 105 of file Rsymdiag.hh.

bool RazorBack::Rsymdiag_::Tridiagdone [private]
 

flag to indicate if tridiagonalisation is done.

Definition at line 107 of file Rsymdiag.hh.

bool RazorBack::Rsymdiag_::Qdone [private]
 

transformation matrix for eigenvectors is done.

Definition at line 107 of file Rsymdiag.hh.

bool RazorBack::Rsymdiag_::QLdone [private]
 

QL done (destructive!).

Definition at line 107 of file Rsymdiag.hh.


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:26 2002 for The Razorback C++ Library: Linear Algebra by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001