44 #ifndef ROL_BLOCKOPERATOR_H
45 #define ROL_BLOCKOPERATOR_H
67 typedef std::vector<ROL::Ptr<OP> >
OpVec;
78 virtual void apply(
V &Hv,
const V &v, Real &tol )
const {
81 PV &Hv_part =
dynamic_cast<PV&
>(Hv);
82 const PV &v_part =
dynamic_cast<const PV&
>(v);
88 ROL_TEST_FOR_EXCEPTION( (nvec1 != nvec2), std::invalid_argument,
89 ">>> ERROR (ROL_BlockOperator, apply): "
90 "Mismatch between input and output number of subvectors.");
92 ROL_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 ROL::Ptr<V> Hvi = Hv_part.
get(i);
99 ROL::Ptr<V> u = Hvi->clone();
103 for(
uint j=0; j<nvec2; ++j ) {
105 (*blocks_)[k]->apply(*u,*v_part.
get(j),tol);
116 #endif // ROL_BLOCKOPERATOR_H
typename PV< Real >::size_type size_type
size_type numVectors() const
ROL::Ptr< const Vector< Real > > get(size_type i) const
Defines the linear algebra of vector space on a generic partitioned vector.
std::vector< ROL::Ptr< OP > > OpVec
Defines the linear algebra or vector space interface.
ROL::Ptr< OpVec > blocks_
PartitionedVector< Real > PV
virtual void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
Provides the interface to apply a linear operator.
Provides the interface to apply a block operator to a partitioned vector.
LinearOperator< Real > OP
BlockOperator(const ROL::Ptr< OpVec > &blocks)