Wrapper class to shift a matrix. More...
#include <usermatrix.h>
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< UserMatrix > | A |
The matrix to shift. | |
dvector | shift |
The shift-value. |
Wrapper class to shift a matrix.
this == *A + diag(shift).
Definition at line 318 of file usermatrix.h.
ShiftMatrix::ShiftMatrix | ( | Pointer< UserMatrix > | A_, | |
const dvector & | shift_ | |||
) | [inline] |
Constructor for a UserMatrix and a shift-value.
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_).
n | The dimension. | |
shift_ | The shift value. |
Definition at line 342 of file usermatrix.h.
void ShiftMatrix::MultV | ( | UserVector< double > & | y, | |
const UserVector< double > & | x | |||
) | const [inline, virtual] |
Computes the product of this matrix with a UserVector<double>.
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.
void ShiftMatrix::MultV | ( | double * | y, | |
const double * | x | |||
) | const [inline, virtual] |
Multiplies the matrix with a double*.
y | The double* to store the result in: y = A*x + diag(shift)*x. | |
x | The double* to multiply with this matrix. |
Reimplemented from UserMatrix.
Definition at line 361 of file usermatrix.h.
double ShiftMatrix::yAx | ( | const UserVector< double > & | y, | |
const UserVector< double > & | x | |||
) | const [inline, virtual] |
Multiplies from left and from right with UserVector<double>.
y | The UserVector<double> to multiply with from left. | |
x | The UserVector<double> to multiply with from right. |
Reimplemented from UserMatrix.
Definition at line 374 of file usermatrix.h.
void ShiftMatrix::print | ( | ostream & | out | ) | const [inline, virtual] |
Prints information about this matrix.
Prints the shift-value and the wrapped matrix.
out | The ostream to print to. |
Reimplemented from UserMatrix.
Definition at line 382 of file usermatrix.h.
Pointer<UserMatrix> ShiftMatrix::A [protected] |
The matrix to shift.
Definition at line 322 of file usermatrix.h.
dvector ShiftMatrix::shift [protected] |
The shift-value.
Definition at line 326 of file usermatrix.h.