ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
operator
ROL_LinearOperatorProduct.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Rapid Optimization Library (ROL) Package
4
//
5
// Copyright 2014 NTESS and the ROL contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef ROL_LINEAROPERATORPRODUCT_H
11
#define ROL_LINEAROPERATORPRODUCT_H
12
13
#include "
ROL_LinearOperator.hpp
"
14
20
21
22
namespace
ROL
{
23
24
template
<
class
Real>
25
class
LinearOperatorProduct
:
public
LinearOperator
<Real> {
26
27
typedef
Vector<Real>
V
;
28
typedef
LinearOperator<Real>
OP
;
29
30
typedef
typename
std::vector<ROL::Ptr<OP> >
::size_type
size_type
;
31
32
private
:
33
34
ROL::Ptr<std::vector<ROL::Ptr<OP> > >
ops_
;
35
36
public
:
37
38
LinearOperatorSum
( ROL::Ptr<OP> &A,
39
ROL::Ptr<OP> &B) {
40
ops_
= ROL::makePtr<std::vector<OP> >>();
41
ops_
->push_back(A);
42
ops_
->push_back(B);
43
}
44
45
LinearOperatorSum
( ROL::Ptr<OP> &A,
46
ROL::Ptr<OP> &B,
47
ROL::Ptr<OP> &C) {
48
ops_
= ROL::makePtr<std::vector<OP> >>();
49
ops_
->push_back(A);
50
ops_
->push_back(B);
51
ops_
->push_back(C);
52
}
53
54
virtual
void
update
(
const
Vector<Real>
&x,
bool
flag =
true
,
int
iter = -1 ) {
55
for
(
size_type
i=0; i<
ops_
->size(); ++i ) {
56
(*ops_)[i]->update(x,flag,
true
);
57
}
58
}
59
60
virtual
void
apply
(
Vector<Real>
&Hv,
const
Vector<Real>
&v, Real &tol )
const
{
61
Hv.
set
(v);
62
for
(
size_type
i=0; i<
ops_
->size(); ++i ) {
63
(*ops_)[i]->apply(Hv,Hv,tol);
64
}
65
}
66
67
virtual
void
applyInverse
(
Vector<Real>
&Hv,
const
Vector<Real>
&v, Real &tol )
const
{
68
Hv.
set
(v);
69
for
(
size_type
i=
ops_
->size()-1; i>=0; --i ) {
70
(*ops_)[i]->applyInverse(Hv,Hv,tol);
71
}
72
}
73
74
};
// class LinearOperatorProduct
75
76
}
// namespace ROL
77
78
#endif
// ROL_LINEAROPERATORPRODUCT_H
ROL_LinearOperator.hpp
ROL::LinearOperatorProduct
Provides the interface to the sequential application of linear operators.
Definition
ROL_LinearOperatorProduct.hpp:25
ROL::LinearOperatorProduct::LinearOperatorSum
LinearOperatorSum(ROL::Ptr< OP > &A, ROL::Ptr< OP > &B)
Definition
ROL_LinearOperatorProduct.hpp:38
ROL::LinearOperatorProduct::ops_
ROL::Ptr< std::vector< ROL::Ptr< OP > > > ops_
Definition
ROL_LinearOperatorProduct.hpp:34
ROL::LinearOperatorProduct::size_type
std::vector< ROL::Ptr< OP > >::size_type size_type
Definition
ROL_LinearOperatorProduct.hpp:30
ROL::LinearOperatorProduct::update
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Definition
ROL_LinearOperatorProduct.hpp:54
ROL::LinearOperatorProduct::applyInverse
virtual void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Definition
ROL_LinearOperatorProduct.hpp:67
ROL::LinearOperatorProduct::V
Vector< Real > V
Definition
ROL_LinearOperatorProduct.hpp:27
ROL::LinearOperatorProduct::LinearOperatorSum
LinearOperatorSum(ROL::Ptr< OP > &A, ROL::Ptr< OP > &B, ROL::Ptr< OP > &C)
Definition
ROL_LinearOperatorProduct.hpp:45
ROL::LinearOperatorProduct::OP
LinearOperator< Real > OP
Definition
ROL_LinearOperatorProduct.hpp:28
ROL::LinearOperatorProduct::apply
virtual void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Definition
ROL_LinearOperatorProduct.hpp:60
ROL::LinearOperator
Provides the interface to apply a linear operator.
Definition
ROL_LinearOperator.hpp:37
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL::Vector::set
virtual void set(const Vector &x)
Set where .
Definition
ROL_Vector.hpp:176
ROL
Definition
ROL_ElementwiseVector.hpp:27
Generated by
1.17.0