DenseMatrix Class Reference

A wrapper class for a dense TNT-matrix. More...

#include <usermatrix.h>

Inheritance diagram for DenseMatrix:
Inheritance graph
[legend]
Collaboration diagram for DenseMatrix:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DenseMatrix (bool allow_destroy_=false)
 Standard-Constructor.
 DenseMatrix (int n, double val=0., bool allow_destroy_=false)
 Constructor for given dimension and optional initial argument.
 DenseMatrix (const UserMatrix &A_, bool allow_destroy_=false)
 Copy-Constructor for a UserMatrix.
 DenseMatrix (const ExtUserMatrix &A_, bool allow_destroy_=false)
 Copy-Constructor for a ExtUserMatrix.
 DenseMatrix (const TNT::Matrix< double > &A_, bool allow_destroy_=false)
 Copy-Constructor for a TNT::Matrix<double>.
 DenseMatrix (const DenseMatrix &D)
 Copy-Constructor.
 operator double * ()
 Gives the elements of this matrix as double*.
DenseMatrixoperator= (const DenseMatrix &D)
 Assign-Operator for a DenseMatrix.
DenseMatrixoperator= (const double scalar)
 Assign-Operator for a double.
dvector operator[] (int i) const
 Returns one row of this matrix.
double & operator() (int row, int col)
 Set's a dvector to one row of this matrix.
double operator() (int row, int col) const
 Operator to read one element of the matrix.
DenseMatrix operator+ (const DenseMatrix &B) const
 Building the sum of this matrix and another one.
DenseMatrix operator- (const DenseMatrix &B) const
 Building the difference of this matrix and another one.
DenseMatrix operator* (const DenseMatrix &B) const
 Building the product of this matrix and another one.
void MultV (UserVector< double > &y_, const UserVector< double > &x_) const
 Multiplication with a UserVector<double>.
void MultV (IntervalVector &y, const IntervalVector &x) const
void MultV (double *y_, const double *x_) const
 Multiplication with a double*.
void set_random (const dvector &lambda)
int eig_ql (vector< dvector > &eig_vec, vector< double > &eig_val) const
 Computes the eigenvalues and eigenvectors with the implicit ql-method.
int eig_ql (dvector &eig_vec, double &eig_val) const
 Computes the minimum eigenvalues and eigenvectors with the implicit ql-method.
void print (ostream &out) const
 Print some information.

Public Attributes

bool allow_destroy
 Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.

Protected Attributes

TNT::Matrix< double > A
 The matrix to wrap.

Private Member Functions

void tred2 (int nm, int n, double *a, double *d, double *e, double *z) const
 Reduce a real symmetric matrix to a symmetric tridiagonal matrix.
int imtql2 (int nm, int n, double *d, double *e, double *z) const
 Finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the implicit ql-method.

Detailed Description

A wrapper class for a dense TNT-matrix.

Definition at line 788 of file usermatrix.h.


Constructor & Destructor Documentation

DenseMatrix::DenseMatrix ( bool  allow_destroy_ = false  )  [inline]

Standard-Constructor.

Parameters:
allow_destroy_ Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation, default is false.
See also:
DenseMatrix(int, double, bool)
DenseMatrix(UserMatrix&, bool)
DenseMatrix(TNT::Matrix<double>&, bool)

Definition at line 853 of file usermatrix.h.

DenseMatrix::DenseMatrix ( int  n,
double  val = 0.,
bool  allow_destroy_ = false 
) [inline]

Constructor for given dimension and optional initial argument.

Parameters:
n The dimension.
val A value for all elements of the matrix, default is 0.
allow_destroy_ Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.
See also:
DenseMatrix(bool)
DenseMatrix(UserMatrix&, bool)
DenseMatrix(TNT::Matrix<double>&, bool)

Definition at line 865 of file usermatrix.h.

DenseMatrix::DenseMatrix ( const UserMatrix A_,
bool  allow_destroy_ = false 
)

Copy-Constructor for a UserMatrix.

Creates a dense matrix from a UserMatrix. It gets the collumns by calling MultV with standard-basis-vectors.

Parameters:
A_ The UserMatrix to copy.
allow_destroy_ Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.
See also:
DenseMatrix(bool)
DenseMatrix(int, double, bool)
DenseMatrix(TNT::Matrix<double>&, bool)
DenseMatrix::DenseMatrix ( const ExtUserMatrix A_,
bool  allow_destroy_ = false 
) [inline]

Copy-Constructor for a ExtUserMatrix.

Parameters:
A_ The matrix to copy.
allow_destroy_ Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.

Definition at line 884 of file usermatrix.h.

DenseMatrix::DenseMatrix ( const TNT::Matrix< double > &  A_,
bool  allow_destroy_ = false 
) [inline]

Copy-Constructor for a TNT::Matrix<double>.

Parameters:
A_ The matrix to copy.
allow_destroy_ Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.
See also:
DenseMatrix(bool)
DenseMatrix(int, double, bool)
DenseMatrix(UserMatrix&, bool)

Definition at line 898 of file usermatrix.h.

DenseMatrix::DenseMatrix ( const DenseMatrix D  )  [inline]

Copy-Constructor.

Parameters:
D The DenseMatrix to copy.

Definition at line 905 of file usermatrix.h.


Member Function Documentation

void DenseMatrix::tred2 ( int  nm,
int  n,
double *  a,
double *  d,
double *  e,
double *  z 
) const [private]

Reduce a real symmetric matrix to a symmetric tridiagonal matrix.

This subroutine is a translation of the algol procedure tred2, num. math. 11, 181-195(1968) by martin, reinsch, and wilkinson. handbook for auto. comp., vol.ii-linear algebra, 212-226(1971).

This subroutine reduces a real symmetric matrix to a symmetric tridiagonal matrix using and accumulating orthogonal similarity transformations.

This version dated august 1983.

a and z may coincide. If distinct, a is unaltered.

Parameters:
nm The row dimension of two-dimensional array parameters as declared in the calling program dimension statement.
n The order of the matrix.
a The real symmetric input matrix. Only the lower triangle of the matrix need be supplied.
d At end contains the diagonal elements of the tridiagonal matrix.
e At end contains the subdiagonal elements of the tridiagonal matrix in its last n-1 positions. e(1) is set to zero.
z At end contains the orthogonal transformation matrix produced in the reduction.
int DenseMatrix::imtql2 ( int  nm,
int  n,
double *  d,
double *  e,
double *  z 
) const [private]

Finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the implicit ql-method.

This subroutine finds the eigenvalues and eigenvectors of a symmetric tridiagonal matrix by the implicit ql method. The eigenvectors of a full symmetric matrix can also be found if tred2 has been used to reduce this full matrix to tridiagonal form.

This subroutine is a translation of the algol procedure imtql2, num. math. 12, 377-383(1968) by martin and wilkinson, as modified in num. math. 15, 450(1970) by dubrulle. handbook for auto. comp., vol.ii-linear algebra, 241-248(1971).

calls pythag for dsqrt(a*a + b*b) .

this version dated august 1983.

Parameters:
nm must be set to the row dimension of two-dimensional array parameters as declared in the calling program dimension statement.
n The order of the matrix.
d The diagonal elements of the input matrix. On output: The eigenvalues in ascending order. If an error exit is made, the eigenvalues are correct but unordered for indices 1,2,...,ierr-1.
e The subdiagonal elements of the input matrix in its last n-1 positions. e(1) is arbitrary. On output: Destroyed.
z The transformation matrix produced in the reduction by tred2, if performed. If the eigenvectors of the tridiagonal matrix are desired, z must contain the identity matrix. On output: The orthonormal eigenvectors of the symmetric tridiagonal (or full) matrix. if an error exit is made, z contains the eigenvectors associated with the stored eigenvalues.
Returns:
zero for normal return, j if the j-th eigenvalue has not been determined after 30 iterations.
DenseMatrix::operator double * (  )  [inline]

Gives the elements of this matrix as double*.

Rowwise.

Definition at line 912 of file usermatrix.h.

DenseMatrix& DenseMatrix::operator= ( const DenseMatrix D  )  [inline]

Assign-Operator for a DenseMatrix.

Parameters:
D The DenseMatrix to copy.
See also:
operator=(const double)
Returns:
This matrix.

Definition at line 921 of file usermatrix.h.

DenseMatrix& DenseMatrix::operator= ( const double  scalar  )  [inline]

Assign-Operator for a double.

Parameters:
scalar A double to set all elements of the matrix to.
See also:
operator=(const DenseMatrix&)

Definition at line 934 of file usermatrix.h.

dvector DenseMatrix::operator[] ( int  i  )  const [inline]

Returns one row of this matrix.

Parameters:
i The index of the row.
Returns:
The i'th row as dvector.
See also:
set_row(dvector&, const int)
operator()(int, int)

Definition at line 945 of file usermatrix.h.

double& DenseMatrix::operator() ( int  row,
int  col 
) [inline]

Set's a dvector to one row of this matrix.

Parameters:
i The index of the row to get.
See also:
operator[](int) Return one element of the matrix.
Parameters:
row The row.
col The column.
Returns:
The element at index [row, col] (C-style).
See also:
operator[](int)

Definition at line 963 of file usermatrix.h.

double DenseMatrix::operator() ( int  row,
int  col 
) const [inline, virtual]

Operator to read one element of the matrix.

Abstract.

Parameters:
row The row of the element to read.
col The col of the element to read.
Returns:
The element at index (row, col).

Implements ExtUserMatrix.

Definition at line 967 of file usermatrix.h.

DenseMatrix DenseMatrix::operator+ ( const DenseMatrix B  )  const [inline]

Building the sum of this matrix and another one.

Parameters:
B Second summand.
Returns:
The sum *this + B as DenseMatrix.
See also:
operator-(const DenseMatrix&)

Definition at line 976 of file usermatrix.h.

DenseMatrix DenseMatrix::operator- ( const DenseMatrix B  )  const [inline]

Building the difference of this matrix and another one.

Parameters:
B Matrix to substract.
Returns:
The difference *this - B as DenseMatrix.
See also:
operator+(const DenseMatrix&)

Definition at line 985 of file usermatrix.h.

DenseMatrix DenseMatrix::operator* ( const DenseMatrix B  )  const [inline]

Building the product of this matrix and another one.

Parameters:
B Matrix to multiply with.
Returns:
The product *this * B as DenseMatrix.
See also:
UserMatrix::operator*(const dvector&)
UserMatrix::operator*(const double*)

Definition at line 995 of file usermatrix.h.

void DenseMatrix::MultV ( UserVector< double > &  y_,
const UserVector< double > &  x_ 
) const [virtual]

Multiplication with a UserVector<double>.

Calls the *-operator form the TNT-matrix.

Parameters:
y_ The UserVector<double> to store the result in.
x_ The UserVector<double> to multiply with.
See also:
MultV(double*, const double*)

Implements UserMatrix.

void DenseMatrix::MultV ( IntervalVector y,
const IntervalVector x 
) const [virtual]
void DenseMatrix::MultV ( double *  y_,
const double *  x_ 
) const [virtual]

Multiplication with a double*.

Calls the *-operator from the TNT-matrix.

Parameters:
y_ The double* to store the result in.
x_ The double* to multiply with.
See also:
MultV(dvector&, const dvector&)

Reimplemented from UserMatrix.

void DenseMatrix::set_random ( const dvector lambda  ) 
int DenseMatrix::eig_ql ( vector< dvector > &  eig_vec,
vector< double > &  eig_val 
) const [virtual]

Computes the eigenvalues and eigenvectors with the implicit ql-method.

If allow_destroy is true, the matrix itselfe is destroyed and holds the computed eigenvectors (in transposed form) after exit.

Parameters:
eig_vec A vector of dvectors for the eigenvectors.
eig_val A vector of double for the eigenvalues.
Returns:
The return value from imtql2, which is 0, if all went good or the number of the eigenvalue, which wasn't founds after 30 iterations.
See also:
tred2(int, int, double*, double*, double*, double*)
imtql2(int, int, double*, double*, double*)
eig_ql(dvector&, double&)

Reimplemented from UserMatrix.

int DenseMatrix::eig_ql ( dvector eig_vec,
double &  eig_val 
) const

Computes the minimum eigenvalues and eigenvectors with the implicit ql-method.

Computes all eigenvalues and look's than for the smallest one.

Parameters:
eig_vec A dvectors for the eigenvector.
eig_val A double for the eigenvalue.
Returns:
The return value from imtql2, which is 0, if all went good or the number of the eigenvalue, which wasn't founds after 30 iterations.
See also:
eig_ql(vector<dvector>&, vector<double>&)
void DenseMatrix::print ( ostream &  out  )  const [inline, virtual]

Print some information.

Calls the output-operator from the TNT-matrix.

Parameters:
out The ostream to print to.

Reimplemented from UserMatrix.

Definition at line 1045 of file usermatrix.h.


Member Data Documentation

TNT::Matrix<double> DenseMatrix::A [protected]

The matrix to wrap.

Definition at line 839 of file usermatrix.h.

Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation.

True save's memory and time.

Definition at line 845 of file usermatrix.h.


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

Generated on 10 Mar 2013 for LaGO by  doxygen 1.6.1