44 #ifndef ROL_BLOCKOPERATOR2DIAGONAL_H 45 #define ROL_BLOCKOPERATOR2DIAGONAL_H 78 void apply(
V &Hv,
const V &v, Real &tol )
const {
81 PV &Hv_pv = Teuchos::dyn_cast<
PV>(Hv);
82 const PV &v_pv = Teuchos::dyn_cast<
const PV>(v);
84 RCP<V> Hv1 = Hv_pv.get(0);
85 RCP<V> Hv2 = Hv_pv.get(1);
86 RCP<const V> v1 = v_pv.get(0);
87 RCP<const V> v2 = v_pv.get(1);
89 A_->apply(*Hv1,*v1,tol);
90 D_->apply(*Hv2,*v2,tol);
98 PV &Hv_pv = Teuchos::dyn_cast<
PV>(Hv);
99 const PV &v_pv = Teuchos::dyn_cast<
const PV>(v);
101 RCP<V> Hv1 = Hv_pv.get(0);
102 RCP<V> Hv2 = Hv_pv.get(1);
103 RCP<const V> v1 = v_pv.get(0);
104 RCP<const V> v2 = v_pv.get(1);
106 A_->applyInverse(*Hv1,*v1,tol);
107 D_->applyInverse(*Hv2,*v2,tol);
111 Teuchos::RCP<LinearOperator<Real> >
getOperator(
int row,
int col )
const {
112 if( row == 0 && col == 0 ) {
115 else if( row == 1 && col == 1 ) {
119 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::invalid_argument,
120 ">>> ERROR (ROL_BlockOperator2Diagonal, getOperator): " 121 "invalid block indices.");
131 #endif // ROL_BLOCKOPERATOR2DIAGONAL_H Provides the interface to apply a 2x2 block diagonal operator to a partitioned vector.
PartitionedVector< Real > PV
Defines the linear algebra of vector space on a generic partitioned vector.
LinearOperator< Real > OP
void applyInverse(V &Hv, const V &v, Real &tol) const
Apply inverse of linear operator.
Defines the linear algebra or vector space interface.
BlockOperator2Diagonal(Teuchos::RCP< OP > &A, Teuchos::RCP< OP > &D)
PartitionedVector< Real > PV
Teuchos::RCP< LinearOperator< Real > > getOperator(int row, int col) const
Provides the interface to apply a linear operator.
void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
Provides the interface to apply a 2x2 block operator to a partitioned vector.