44 #ifndef ROL_NULL_SPACE_OPERATOR_H
45 #define ROL_NULL_SPACE_OPERATOR_H
65 const Ptr<Constraint<Real>>
con_;
73 mutable Ptr<Vector<Real>>
v1_;
74 mutable Ptr<Vector<Real>>
v2_;
75 mutable Ptr<PartitionedVector<Real>>
vv_;
76 mutable Ptr<Vector<Real>>
b1_;
77 mutable Ptr<Vector<Real>>
b2_;
78 mutable Ptr<PartitionedVector<Real>>
bb_;
79 mutable Ptr<Vector<Real>>
w1_;
80 mutable Ptr<Vector<Real>>
w2_;
81 mutable Ptr<PartitionedVector<Real>>
ww_;
82 mutable Ptr<Vector<Real>>
mul_;
90 bool refine =
false)
const {
97 b.
axpy( static_cast<Real>(-1), *
vv_ );
102 krylov_->resetAbsoluteTolerance(tol);
124 dim_ = ran->dimension();
126 Real tol = std::sqrt(ROL_EPSILON<Real>());
127 b1_ = dom->dual().clone();
128 b2_ = ran->clone();
b2_->setScalar(1.0);
129 con_->applyAdjointJacobian(*
b1_,*
b2_,*dom,tol);
134 Real atol =
static_cast<Real
>(1e-12);
135 Real rtol =
static_cast<Real
>(1e-2);
136 list.sublist(
"General").sublist(
"Krylov").set(
"Type",
"GMRES");
137 list.sublist(
"General").sublist(
"Krylov").set(
"Absolute Tolerance", atol);
138 list.sublist(
"General").sublist(
"Krylov").set(
"Relative Tolerance", rtol);
139 list.sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 200);
140 krylov_ = KrylovFactory<Real>(list);
142 augsys_ = makePtr<AugmentedSystemOperator<Real>>(con,dom);
143 augsysprec_ = makePtr<AugmentedSystemPrecOperator<Real>>(con,dom);
145 v1_ = dom->dual().clone();
146 v2_ = ran->dual().clone();
147 vv_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
v1_,
v2_}));
149 w1_ = dom->dual().clone();
150 w2_ = ran->dual().clone();
151 ww_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
w1_,
w2_}));
153 b1_ = dom->dual().clone();
155 bb_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
b1_,
b2_}));
157 mul_ = ran->dual().clone();
169 Ptr<PartitionedVector<Real>> sol = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({makePtrFromRef(Hv),
mul_}));
Ptr< Vector< Real > > b1_
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Ptr< Vector< Real > > v1_
Ptr< PartitionedVector< Real > > ww_
Ptr< PartitionedVector< Real > > bb_
Ptr< Vector< Real > > mul_
Ptr< Vector< Real > > w1_
virtual void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
Ptr< LinearOperator< Real > > augsys_
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
void applyAdjointInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of the inverse linear operator.
Ptr< PartitionedVector< Real > > vv_
Ptr< LinearOperator< Real > > augsysprec_
Projects on to the null space of a linear constraint.
virtual ~NullSpaceOperator()
const Ptr< Constraint< Real > > con_
Ptr< Vector< Real > > v2_
Ptr< Vector< Real > > w2_
Ptr< Krylov< Real > > krylov_
void solveAugmentedSystem(Vector< Real > &v, Vector< Real > &b, Real &tol, bool refine=false) const
Provides the interface to apply a linear operator.
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
NullSpaceOperator(const Ptr< Constraint< Real >> &con, const Ptr< Vector< Real >> &dom, const Ptr< Vector< Real >> &ran)
virtual void set(const Vector &x)
Set where .
void applyAdjoint(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply adjoint of linear operator.
Ptr< Vector< Real > > b2_
Defines the general constraint operator interface.