44 #ifndef MY_BETTER_OPERATOR_HPP
45 #define MY_BETTER_OPERATOR_HPP
65 template <
class ScalarType>
73 const int nnz,
const int *rowin,
const ScalarType *vals)
76 std::copy<const int*,IntIter>(colptr,colptr+nrows+1,
_cptr.begin());
77 std::copy<const int*,IntIter>(rowin,rowin+nnz,
_rind.begin());
78 std::copy<const ScalarType*,STIter>(vals,vals+nnz,
_vals.begin());
110 for (j=0; j<
_nr; j++) {
113 for (i=IA1; i<IA2; i++) {
116 for (v=0; v<nv; v++) {
117 (*MyY)[v][ri] += aval*(*MyX)[v][j];
124 for (
int j=0; j<
_nr; j++) {
125 int IA1 =
_cptr[j]-1;
126 int IA2 =
_cptr[j+1]-1;
127 for (
int i=IA1; i<IA2; i++) {
128 os <<
"("<<
_rind[i]-1<<
","<<j<<
")\t"<<
_vals[i]<< std::endl;
134 typedef typename std::vector<ScalarType>::iterator
STIter;
146 #endif //MY_BETTER_OPERATOR_HPP
std::vector< int >::iterator IntIter
std::vector< ScalarType >::iterator STIter
void Apply(const Belos::MultiVec< ScalarType > &X, Belos::MultiVec< ScalarType > &Y, Belos::ETrans trans=Belos::NOTRANS) const
Applies the matrix to a multivector.
MyBetterOperator(const int nrows, const int *colptr, const int nnz, const int *rowin, const ScalarType *vals)
Constructor.
~MyBetterOperator()
Deconstructor.
virtual int GetNumberVecs() const =0
The number of vectors (i.e., columns) in the multivector.
std::vector< ScalarType > _vals
Values.
void Print(std::ostream &os)
virtual ptrdiff_t GetGlobalLength() const =0
The number of rows in the multivector.
ETrans
Whether to apply the (conjugate) transpose of an operator.
Simple example of a user's defined Belos::MultiVec class.
Alternative run-time polymorphic interface for operators.
std::vector< int > _rind
Row indices.
std::vector< int > _cptr
Column pointers.
Alternative run-time polymorphic interface for operators.
Interface for multivectors used by Belos' linear solvers.
Belos header file which uses auto-configuration information to include necessary C++ headers...
void MvInit(const ScalarType alpha)
Replace each element of the vectors in *this with alpha.
Simple example of a user's defined Belos::Operator class.
int _nr
Number of rows and columns.