ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
operator
ROL_BlockOperator2UnitLower.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_BLOCKOPERATOR2UNITLOWER_H
11
#define ROL_BLOCKOPERATOR2UNITLOWER_H
12
13
#include "
ROL_BlockOperator2.hpp
"
14
25
26
namespace
ROL
{
27
28
template
<
class
Real>
29
class
BlockOperator2UnitLower
:
public
LinearOperator
<Real> {
30
31
typedef
Vector<Real>
V
;
// ROL Vector
32
typedef
PartitionedVector<Real>
PV
;
// ROL PartitionedVector
33
typedef
LinearOperator<Real>
OP
;
// Linear Operator
34
35
private
:
36
37
ROL::Ptr<OP>
C_
;
38
39
40
public
:
41
42
BlockOperator2UnitLower
( ROL::Ptr<OP> &C ) :
C_
(C) {}
43
}
44
45
void
apply
(
V
&Hv,
const
V
&v, Real &tol )
const
{
46
47
48
PV
&Hv_pv =
dynamic_cast<
PV
&
>
(Hv);
49
const
PV
&v_pv =
dynamic_cast<
const
PV
&
>
(v);
50
51
ROL::Ptr<V> Hv1 = Hv_pv.get(0);
52
ROL::Ptr<V> Hv2 = Hv_pv.get(1);
53
ROL::Ptr<const V> v1 = v_pv.get(0);
54
ROL::Ptr<const V> v2 = v_pv.get(1);
55
56
Hv1->set(*v1);
57
C_
->apply(*Hv2,*v1,tol);
58
Hv2->plus(*v2);
59
}
60
61
62
void
applyInverse
(
V
&Hv,
const
V
&v Real &tol )
const
{
63
64
65
PV
&Hv_pv =
dynamic_cast<
PV
&
>
(Hv);
66
const
PV
&v_pv =
dynamic_cast<
const
PV
&
>
(v);
67
68
ROL::Ptr<V> Hv1 = Hv_pv.get(0);
69
ROL::Ptr<V> Hv2 = Hv_pv.get(1);
70
ROL::Ptr<const V> v1 = v_pv.get(0);
71
ROL::Ptr<const V> v2 = v_pv.get(1);
72
73
Hv1->set(*v1);
74
C_
->apply(*Hv2,*v1,tol);
75
Hv2->scale(-1.0);
76
Hv2->plus(*v2);
77
78
}
79
80
ROL::Ptr<LinearOperator<Real> >
getOperator
(
int
row,
int
col )
const
{
81
if
( row == 1 && col == 0 ) {
82
return
C_
;
83
}
84
else
{
85
ROL_TEST_FOR_EXCEPTION(
true
, std::invalid_argument,
86
">>> ERROR (ROL_BlockOperator2UnitLower, getOperator): "
87
"invalid block indices."
);
88
}
89
90
}
91
92
93
};
// class BlockOperator2UnitLower
94
95
}
// namespace ROL
96
97
#endif
// ROL_BLOCKOPERATOR2UNITLOWER_H
V
Vector< Real > V
Definition
ROL_BlockOperator2Diagonal.hpp:46
PV
PartitionedVector< Real > PV
Definition
ROL_BlockOperator2Diagonal.hpp:47
C_
ROL::Ptr< OP > C_
Definition
ROL_BlockOperator2UnitLower.hpp:53
ROL_BlockOperator2.hpp
ROL::BlockOperator2UnitLower::BlockOperator2UnitLower
BlockOperator2UnitLower(ROL::Ptr< OP > &C)
Definition
ROL_BlockOperator2UnitLower.hpp:42
ROL::BlockOperator2UnitLower::PV
PartitionedVector< Real > PV
Definition
ROL_BlockOperator2UnitLower.hpp:32
ROL::BlockOperator2UnitLower::OP
LinearOperator< Real > OP
Definition
ROL_BlockOperator2UnitLower.hpp:33
ROL::BlockOperator2UnitLower::V
Vector< Real > V
Definition
ROL_BlockOperator2UnitLower.hpp:31
ROL::BlockOperator2UnitLower::C_
ROL::Ptr< OP > C_
Definition
ROL_BlockOperator2UnitLower.hpp:37
ROL::LinearOperator
Provides the interface to apply a linear operator.
Definition
ROL_LinearOperator.hpp:37
ROL::PartitionedVector
Defines the linear algebra of vector space on a generic partitioned vector.
Definition
ROL_PartitionedVector.hpp:26
ROL::Vector
Defines the linear algebra or vector space interface.
Definition
ROL_Vector.hpp:51
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::apply
ROL::BlockOperator2Diagonal BlockOperator2 apply(V &Hv, const V &v, Real &tol) const
Definition
ROL_BlockOperator2Diagonal.hpp:44
ROL::getOperator
ROL::Ptr< LinearOperator< Real > > getOperator(int row, int col) const
Definition
ROL_BlockOperator2Diagonal.hpp:77
ROL::applyInverse
void applyInverse(V &Hv, const V &v Real &tol) const
Definition
ROL_BlockOperator2Diagonal.hpp:61
Generated by
1.17.0