12 #ifndef MY_OPERATOR_HPP
13 #define MY_OPERATOR_HPP
32 template <
class ScalarType>
51 MyOperator(
const int NumRows, std::vector<ScalarType> ldu) :
63 diag_.resize(diag.size());
64 for(
unsigned int i=0; i<
diag_.size(); ++i)
88 if (
diag_.size() == 0)
97 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
u_ * (*MyX)[v][i + 1]);
101 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
l_ * (*MyX)[v][i-1]);
105 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
l_ * (*MyX)[v][i-1] +
u_ * (*MyX)[v][i+1]);
117 (*MyY)[v][i] =
diag_[i] * (*MyX)[v][i];
132 #endif //MY_OPERATOR_HPP
MyOperator(const int NumRows, std::vector< ScalarType > ldu)
virtual int GetNumberVecs() const =0
The number of vectors (i.e., columns) in the multivector.
void Apply(const Belos::MultiVec< ScalarType > &X, Belos::MultiVec< ScalarType > &Y, Belos::ETrans trans=Belos::NOTRANS) const
Applies the tridiagonal or diagonal matrix to a multivector.
virtual ptrdiff_t GetGlobalLength() const =0
The number of rows in the multivector.
ETrans
Whether to apply the (conjugate) transpose of an operator.
MyOperator(std::vector< ScalarType > diag)
Simple example of a user's defined Belos::MultiVec class.
std::vector< ScalarType > diag_
Elements on diagonal (for variable-diagonal case).
Alternative run-time polymorphic interface for operators.
int NumRows_
Number of rows and columns.
ScalarType l_
Elements on subdiagonal, diagonal, and superdiagonal.
Alternative run-time polymorphic interface for operators.
Simple example of a user's defined Belos::Operator class.
Interface for multivectors used by Belos' linear solvers.
Belos header file which uses auto-configuration information to include necessary C++ headers...
MyOperator(const int NumRows)