44 #ifndef MY_OPERATOR_HPP
45 #define MY_OPERATOR_HPP
64 template <
class ScalarType>
83 MyOperator(
const int NumRows, std::vector<ScalarType> ldu) :
95 diag_.resize(diag.size());
96 for(
unsigned int i=0; i<
diag_.size(); ++i)
120 if (
diag_.size() == 0)
129 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
u_ * (*MyX)[v][i + 1]);
133 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
l_ * (*MyX)[v][i-1]);
137 (*MyY)[v][i] = (
d_ * (*MyX)[v][i] +
l_ * (*MyX)[v][i-1] +
u_ * (*MyX)[v][i+1]);
149 (*MyY)[v][i] =
diag_[i] * (*MyX)[v][i];
164 #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)