ShiftMatrix Class Reference

Wrapper class to shift a matrix. More...

#include <usermatrix.h>

Inheritance diagram for ShiftMatrix:

Inheritance graph
[legend]
Collaboration diagram for ShiftMatrix:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ShiftMatrix (Pointer< UserMatrix > A_, const dvector &shift_)
 Constructor for a UserMatrix and a shift-value.
 ShiftMatrix (int n, const dvector &shift_)
 Constructor for a dimension and a shift-value.
void MultV (UserVector< double > &y, const UserVector< double > &x) const
 Computes the product of this matrix with a UserVector<double>.
void MultV (double *y, const double *x) const
 Multiplies the matrix with a double*.
double yAx (const UserVector< double > &y, const UserVector< double > &x) const
 Multiplies from left and from right with UserVector<double>.
void print (ostream &out) const
 Prints information about this matrix.

Protected Attributes

Pointer< UserMatrixA
 The matrix to shift.
dvector shift
 The shift-value.

Detailed Description

Wrapper class to shift a matrix.

this == *A + diag(shift).

Definition at line 318 of file usermatrix.h.


Constructor & Destructor Documentation

ShiftMatrix::ShiftMatrix ( Pointer< UserMatrix A_,
const dvector shift_ 
) [inline]

Constructor for a UserMatrix and a shift-value.

Parameters:
A_ The UserMatrix to shift.
shift_ The shift-value.

Definition at line 333 of file usermatrix.h.

ShiftMatrix::ShiftMatrix ( int  n,
const dvector shift_ 
) [inline]

Constructor for a dimension and a shift-value.

So, this is the matrix diag(shift_).

Parameters:
n The dimension.
shift_ The shift value.

Definition at line 342 of file usermatrix.h.


Member Function Documentation

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

Computes the product of this matrix with a UserVector<double>.

Parameters:
y The UserVector<double> to store the result in: y = A*x + diag(shift)*x.
x The UserVector<double> to multiply with the matrix.

Implements UserMatrix.

Definition at line 350 of file usermatrix.h.

References A, UserVector< Type >::diagmult(), and shift.

void ShiftMatrix::MultV ( double *  y,
const double *  x 
) const [inline, virtual]

Multiplies the matrix with a double*.

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

Reimplemented from UserMatrix.

Definition at line 361 of file usermatrix.h.

References A, UserMatrix::dim(), and shift.

double ShiftMatrix::yAx ( const UserVector< double > &  y,
const UserVector< double > &  x 
) const [inline, virtual]

Multiplies from left and from right with UserVector<double>.

Parameters:
y The UserVector<double> to multiply with from left.
x The UserVector<double> to multiply with from right.
Returns:
The double value y*A*x + y*diag(shift)*x.

Reimplemented from UserMatrix.

Definition at line 374 of file usermatrix.h.

References A, UserVector< Type >::diagmult(), and shift.

void ShiftMatrix::print ( ostream &  out  )  const [inline, virtual]

Prints information about this matrix.

Prints the shift-value and the wrapped matrix.

Parameters:
out The ostream to print to.

Reimplemented from UserMatrix.

Definition at line 382 of file usermatrix.h.

References A, UserMatrix::dim(), and shift.


Member Data Documentation

Pointer<UserMatrix> ShiftMatrix::A [protected]

The matrix to shift.

Definition at line 322 of file usermatrix.h.

Referenced by MultV(), print(), and yAx().

dvector ShiftMatrix::shift [protected]

The shift-value.

Definition at line 326 of file usermatrix.h.

Referenced by MultV(), print(), and yAx().


The documentation for this class was generated from the following file:
Generated on Tue Oct 21 03:12:41 2008 for LaGO by  doxygen 1.4.7