UserMatrix Class Reference

Abstract class for a user defined quadratic matrix. More...

#include <usermatrix.h>

Inheritance diagram for UserMatrix:
Inheritance graph
[legend]

List of all members.

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.

Detailed Description

Abstract class for a user defined quadratic matrix.

Following methods are abstract:

Definition at line 35 of file usermatrix.h.


Constructor & Destructor Documentation

UserMatrix::UserMatrix ( int  n = 0  )  [inline]

(Standard-)Constructor for the dimension.

Parameters:
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.


Member Function Documentation

int UserMatrix::dim (  )  const [inline]

Gives the dimension.

Returns:
The dimension as int.

Definition at line 70 of file usermatrix.h.

virtual void UserMatrix::MultV ( UserVector< double > &  y,
const UserVector< double > &  x 
) const [pure virtual]

Multiplies with a UserVector<double>.

Abstract.

Parameters:
y The UserVector<double> to store the result in: y = *this * x.
x The UserVector<double> to multiply with.
See also:
MultV(double*, double*)

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*.

Parameters:
y The double* to store the result in.
x The double* to multiply with this matrix.
See also:
MultV(dvector&, const dvector&)

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.

Parameters:
y The UserVector<double> to multiply with from left.
x The UserVector<double> to multiply with from right.
Returns:
The double value y*this*x.
See also:
xAx(const UserVector<double>&)

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>.

Parameters:
x The UserVector<double> to multiply with.
Returns:
The double yAx(x,x).
See also:
yAx(const UserVector<double>&, const UserVector<double>&)

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>.

Parameters:
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.

dvector UserMatrix::operator* ( const dvector x  )  const [inline]

Multiplies this matrix with a dvector.

Parameters:
x The dvector to multiply with.
Returns:
The result (this*x).
See also:
MultV(dvector&, const dvector&)

Definition at line 125 of file usermatrix.h.

double* UserMatrix::operator* ( const double *  x  )  const [inline]

Multiplies this matrix with a double*.

Parameters:
x The double* to multiply with.
Returns:
The result as a new(!!) double*.
See also:
MultV(double*, double*)

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.

Parameters:
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.
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:
DenseMatrix::eig_ql(vector<dvector>&, vector<double>&, Param*)

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.

Parameters:
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.
Returns:
Depends on the choosen eigenvalue algorithm. It's 0, if all went good.
See also:
eig_ql(vector<dvector>&, vector<double>&)
eig_lanczos(vector<dvector>&, vector<double>&, Param*)
eig_arpack(vector<dvector>&, vector<double>&, Param*)
int UserMatrix::eig ( dvector eig_vec,
double &  eig_val,
Param param = NULL 
)

Calculates the smallest eigenvalue of this matrix.

Parameters:
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.
Returns:
Depends on the choosen eigenvalue algorithm. It's 0, if all went good.
See also:
eig(vector<dvector>&, vector<double>&, Param*)
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.

Parameters:
out The ostream to print to.
See also:
DenseMatrix::print(ostream&)

Reimplemented in HessMatrix, ShiftMatrix, MinusMatrix, SumMatrix, DiagMatrix, BlockMatrix, DenseMatrix, and SparseMatrix2.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const UserMatrix a 
) [friend]

Prints out information about the matrix.

Calls a.print(out).

Parameters:
out The ostream to print to.
a The UserMatrix to get informations about.
Returns:
The ostream.
See also:
print(ostream&)

Definition at line 47 of file usermatrix.h.


Member Data Documentation

int UserMatrix::dim_ [protected]

The dimension of this matrix.

Definition at line 48 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