44 #ifndef ROL_BLOCKOPERATOR_H 45 #define ROL_BLOCKOPERATOR_H 67 typedef std::vector<Teuchos::RCP<OP> >
OpVec;
68 typedef typename OpVec::size_type
uint;
78 virtual void apply( V &Hv,
const V &v, Real &tol )
const {
81 PV &Hv_part = Teuchos::dyn_cast<PV>(Hv);
82 const PV &v_part = Teuchos::dyn_cast<
const PV>(v);
84 uint nvec1 = v_part.numVectors();
86 uint nblks = blocks_->size();
88 TEUCHOS_TEST_FOR_EXCEPTION( (nvec1 != nvec2), std::invalid_argument,
89 ">>> ERROR (ROL_BlockOperator, apply): " 90 "Mismatch between input and output number of subvectors.");
92 TEUCHOS_TEST_FOR_EXCEPTION( (nblks != nvec1*nvec2 ) , std::invalid_argument,
93 ">>> ERROR (ROL_BlockOperator, apply): " 94 "Block operator dimension mismatch.");
96 for( uint i=0; i<nvec1; ++i ) {
98 Teuchos::RCP<V> Hvi = Hv_part.
get(i);
99 Teuchos::RCP<V> u = Hvi->clone();
103 for( uint j=0; j<nvec2; ++j ) {
105 (*blocks_)[k]->apply(*u,*v_part.get(j),tol);
127 Teuchos::RCP<OP> &a12, Teuchos::RCP<OP> &a22 ) {
133 RCP<vector<RCP<OP> > > ops = rcp(
new vector<RCP<OP> > );
142 void apply( V &Hv,
const V &v, Real &tol )
const {
143 bkop_->apply(Hv,v,tol);
149 #endif // ROL_BLOCKOPERATOR_H
size_type numVectors() const
Defines the linear algebra of vector space on a generic partitioned vector.
Defines the linear algebra or vector space interface.
LinearOperator< Real > OP
Teuchos::RCP< const Vector< Real > > get(size_type i) const
PartitionedVector< Real > PV
void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
virtual void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
BlockOperator(const Teuchos::RCP< OpVec > &blocks)
Provides the interface to apply a linear operator.
Teuchos::RCP< OpVec > blocks_
Provides the interface to apply a block operator to a partitioned vector.
LinearOperator< Real > OP
BlockOperator2(Teuchos::RCP< OP > &a11, Teuchos::RCP< OP > &a21, Teuchos::RCP< OP > &a12, Teuchos::RCP< OP > &a22)
std::vector< Teuchos::RCP< OP > > OpVec