A wrapper class for a dense TNT-matrix. More...
#include <usermatrix.h>
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*. | |
DenseMatrix & | operator= (const DenseMatrix &D) |
Assign-Operator for a DenseMatrix. | |
DenseMatrix & | operator= (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. |
A wrapper class for a dense TNT-matrix.
Definition at line 788 of file usermatrix.h.
DenseMatrix::DenseMatrix | ( | bool | allow_destroy_ = false |
) | [inline] |
Standard-Constructor.
allow_destroy_ | Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation, default is false. |
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.
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. |
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.
A_ | The UserMatrix to copy. | |
allow_destroy_ | Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation. |
DenseMatrix::DenseMatrix | ( | const ExtUserMatrix & | A_, | |
bool | allow_destroy_ = false | |||
) | [inline] |
Copy-Constructor for a ExtUserMatrix.
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>.
A_ | The matrix to copy. | |
allow_destroy_ | Indicates, whether it is allowed to destroy the matrix during the eigenvalue computation. |
Definition at line 898 of file usermatrix.h.
DenseMatrix::DenseMatrix | ( | const DenseMatrix & | D | ) | [inline] |
Copy-Constructor.
D | The DenseMatrix to copy. |
Definition at line 905 of file usermatrix.h.
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.
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.
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. |
DenseMatrix::operator double * | ( | ) | [inline] |
DenseMatrix& DenseMatrix::operator= | ( | const DenseMatrix & | D | ) | [inline] |
Assign-Operator for a DenseMatrix.
D | The DenseMatrix to copy. |
Definition at line 921 of file usermatrix.h.
DenseMatrix& DenseMatrix::operator= | ( | const double | scalar | ) | [inline] |
Assign-Operator for a double.
scalar | A double to set all elements of the matrix to. |
Definition at line 934 of file usermatrix.h.
dvector DenseMatrix::operator[] | ( | int | i | ) | const [inline] |
Returns one row of this matrix.
i | The index of the row. |
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.
i | The index of the row to get. |
row | The row. | |
col | The column. |
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.
row | The row of the element to read. | |
col | The col of the element to read. |
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.
B | Second summand. |
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.
B | Matrix to substract. |
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.
B | Matrix to multiply with. |
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.
y_ | The UserVector<double> to store the result in. | |
x_ | The UserVector<double> to multiply with. |
Implements UserMatrix.
void DenseMatrix::MultV | ( | IntervalVector & | y, | |
const IntervalVector & | x | |||
) | const [virtual] |
Implements IntervalCompliantMatrix.
void DenseMatrix::MultV | ( | double * | y_, | |
const double * | x_ | |||
) | const [virtual] |
Multiplication with a double*.
Calls the *-operator from the TNT-matrix.
y_ | The double* to store the result in. | |
x_ | The double* to multiply with. |
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.
eig_vec | A vector of dvectors for the eigenvectors. | |
eig_val | A vector of double for the eigenvalues. |
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.
eig_vec | A dvectors for the eigenvector. | |
eig_val | A double for the eigenvalue. |
void DenseMatrix::print | ( | ostream & | out | ) | const [inline, virtual] |
Print some information.
Calls the output-operator from the TNT-matrix.
out | The ostream to print to. |
Reimplemented from UserMatrix.
Definition at line 1045 of file usermatrix.h.
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.