Abstract class for a user defined quadratic matrix. More...
#include <usermatrix.h>
Public Member Functions | |
UserMatrix (int n=0) | |
(Standard-)Constructor for the dimension. | |
virtual | ~UserMatrix () |
Virtual Destructor. | |
int | dim () const |
Gives the dimension. | |
virtual void | MultV (UserVector< double > &y, const UserVector< double > &x) const =0 |
Multiplies with a UserVector<double>. | |
virtual void | MultV (double *y, const double *x) const |
Multiplies the matrix with a double*. | |
virtual double | yAx (const UserVector< double > &y, const UserVector< double > &x) const |
Multiplies from left and from right with UserVector<double>'s. | |
virtual double | xAx (const UserVector< double > &x) const |
Multiplies the quadratic product of this matrix and a UserVector<double>. | |
virtual void | AddMult (UserVector< double > &y, const UserVector< double > &x, const double val) const |
Adds to a UserVector<double> the product of a double value and this matrix, multiplied with a UserVector<double>. | |
dvector | operator* (const dvector &x) const |
Multiplies this matrix with a dvector. | |
double * | operator* (const double *x) const |
Multiplies this matrix with a double*. | |
Pointer< UserVector< double > > | operator* (const Pointer< UserVector< double > > x) const |
virtual int | eig_ql (vector< dvector > &eig_vec, vector< double > &eig_val) const |
Calculates the smallest eigenvalues and eigenvectors with the QL-algorithm. | |
int | eig (vector< dvector > &eig_vec, vector< double > &eig_val, Param *param=NULL) |
Calculates the smallest eigenvalues of this matrix. | |
int | eig (dvector &eig_vec, double &eig_val, Param *param=NULL) |
Calculates the smallest eigenvalue of this matrix. | |
virtual void | print (ostream &out) const |
Prints out this matrix. | |
Protected Attributes | |
int | dim_ |
The dimension of this matrix. | |
Friends | |
ostream & | operator<< (ostream &out, const UserMatrix &a) |
Prints out information about the matrix. |
Abstract class for a user defined quadratic matrix.
Following methods are abstract:
Definition at line 35 of file usermatrix.h.
UserMatrix::UserMatrix | ( | int | n = 0 |
) | [inline] |
(Standard-)Constructor for the dimension.
n | The dimension, default is 0. |
Definition at line 59 of file usermatrix.h.
virtual UserMatrix::~UserMatrix | ( | ) | [inline, virtual] |
Virtual Destructor.
Definition at line 65 of file usermatrix.h.
int UserMatrix::dim | ( | ) | const [inline] |
virtual void UserMatrix::MultV | ( | UserVector< double > & | y, | |
const UserVector< double > & | x | |||
) | const [pure virtual] |
Multiplies with a UserVector<double>.
Abstract.
y | The UserVector<double> to store the result in: y = *this * x. | |
x | The UserVector<double> to multiply with. |
Implemented in QqpMatrix, QqpExtMatrix, HessMatrix, ShiftMatrix, MinusMatrix, SumMatrix, DiagMatrix, BlockMatrix, DenseMatrix, and SparseMatrix2.
virtual void UserMatrix::MultV | ( | double * | y, | |
const double * | x | |||
) | const [inline, virtual] |
Multiplies the matrix with a double*.
y | The double* to store the result in. | |
x | The double* to multiply with this matrix. |
Reimplemented in ShiftMatrix, MinusMatrix, DenseMatrix, and SparseMatrix2.
Definition at line 85 of file usermatrix.h.
virtual double UserMatrix::yAx | ( | const UserVector< double > & | y, | |
const UserVector< double > & | x | |||
) | const [inline, virtual] |
Multiplies from left and from right with UserVector<double>'s.
y | The UserVector<double> to multiply with from left. | |
x | The UserVector<double> to multiply with from right. |
Reimplemented in ShiftMatrix, MinusMatrix, DiagMatrix, BlockMatrix, and SparseMatrix2.
Definition at line 97 of file usermatrix.h.
virtual double UserMatrix::xAx | ( | const UserVector< double > & | x | ) | const [inline, virtual] |
Multiplies the quadratic product of this matrix and a UserVector<double>.
x | The UserVector<double> to multiply with. |
Reimplemented in SparseMatrix2.
Definition at line 108 of file usermatrix.h.
virtual void UserMatrix::AddMult | ( | UserVector< double > & | y, | |
const UserVector< double > & | x, | |||
const double | val | |||
) | const [inline, virtual] |
Adds to a UserVector<double> the product of a double value and this matrix, multiplied with a UserVector<double>.
y | The UserVector<double> to store the result in: y + val * A * x | |
x | The UserVector<double> to multiply this matrix with. | |
val | The double to multiply with. |
Reimplemented in SparseMatrix2.
Definition at line 116 of file usermatrix.h.
Multiplies this matrix with a dvector.
x | The dvector to multiply with. |
Definition at line 125 of file usermatrix.h.
double* UserMatrix::operator* | ( | const double * | x | ) | const [inline] |
Multiplies this matrix with a double*.
x | The double* to multiply with. |
Definition at line 136 of file usermatrix.h.
Pointer<UserVector<double> > UserMatrix::operator* | ( | const Pointer< UserVector< double > > | x | ) | const [inline] |
Definition at line 142 of file usermatrix.h.
virtual int UserMatrix::eig_ql | ( | vector< dvector > & | eig_vec, | |
vector< double > & | eig_val | |||
) | const [virtual] |
Calculates the smallest eigenvalues and eigenvectors with the QL-algorithm.
Converts the matrix to a DenseMatrix and calls eig_ql from there.
eig_vec | A vector of dvectors to store the eigenvectors in. | |
eig_val | A vector of doubles to store the eigenvalues in. | |
param | Some parameters, default is NULL. |
Reimplemented in DenseMatrix.
int UserMatrix::eig | ( | vector< dvector > & | eig_vec, | |
vector< double > & | eig_val, | |||
Param * | param = NULL | |||
) |
Calculates the smallest eigenvalues of this matrix.
If dim>=50, calls the lanczos-algorithm. Otherwise a DenseMatrix is created and the ql-algorithm called.
eig_vec | The dvectors to store the eigenvectors in. | |
eig_val | The doubles to store the eigenvalues in. | |
param | Parameters for Lanczos or ARPACK, default is NULL. |
Calculates the smallest eigenvalue of this matrix.
eig_vec | The dvector to store the smallest eigenvector in. | |
eig_val | The double to store the smallest eigenvalue in. | |
param | Parameters for the lanczos-algorithm, default is NULL. |
virtual void UserMatrix::print | ( | ostream & | out | ) | const [virtual] |
Prints out this matrix.
Generates a DenseMatrix with the values of this matrix and prints this one.
out | The ostream to print to. |
Reimplemented in HessMatrix, ShiftMatrix, MinusMatrix, SumMatrix, DiagMatrix, BlockMatrix, DenseMatrix, and SparseMatrix2.
ostream& operator<< | ( | ostream & | out, | |
const UserMatrix & | a | |||
) | [friend] |
Prints out information about the matrix.
Calls a.print(out).
out | The ostream to print to. | |
a | The UserMatrix to get informations about. |
Definition at line 47 of file usermatrix.h.
int UserMatrix::dim_ [protected] |
The dimension of this matrix.
Definition at line 48 of file usermatrix.h.