10 #ifndef ROL_BLOCKOPERATOR_H
11 #define ROL_BLOCKOPERATOR_H
33 typedef std::vector<ROL::Ptr<OP> >
OpVec;
44 virtual void apply(
V &Hv,
const V &v, Real &tol )
const {
47 PV &Hv_part =
dynamic_cast<PV&
>(Hv);
48 const PV &v_part =
dynamic_cast<const PV&
>(v);
54 ROL_TEST_FOR_EXCEPTION( (nvec1 != nvec2), std::invalid_argument,
55 ">>> ERROR (ROL_BlockOperator, apply): "
56 "Mismatch between input and output number of subvectors.");
58 ROL_TEST_FOR_EXCEPTION( (nblks != nvec1*nvec2 ) , std::invalid_argument,
59 ">>> ERROR (ROL_BlockOperator, apply): "
60 "Block operator dimension mismatch.");
62 for(
uint i=0; i<nvec1; ++i ) {
64 ROL::Ptr<V> Hvi = Hv_part.
get(i);
65 ROL::Ptr<V> u = Hvi->clone();
69 for(
uint j=0; j<nvec2; ++j ) {
71 (*blocks_)[k]->apply(*u,*v_part.
get(j),tol);
82 #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)