ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
operator
ROL_BlockOperator2Diagonal.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_BLOCKOPERATOR2DIAGONAL_H
11
#define ROL_BLOCKOPERATOR2DIAGONAL_H
12
13
#include "
ROL_BlockOperator2.hpp
"
14
24
25
namespace
ROL
{
26
27
template
<
class
Real>
28
class
BlockOperator2Diagonal
:
public
BlockOperator2
<Real> {
29
30
typedef
Vector<Real>
V
;
// ROL Vector
31
typedef
PartitionedVector<Real>
PV
;
// ROL PartitionedVector
32
typedef
LinearOperator<Real>
OP
;
// Linear Operator
33
34
private
:
35
36
ROL::Ptr<OP>
A_
,
D_
;
37
38
public
:
39
40
BlockOperator2Diagonal
( ROL::Ptr<OP> &A, ROL::Ptr<OP> &D ) :
A_
(A),
D_
(D) {}
41
42
}
43
44
void
apply
(
V
&Hv,
const
V
&v, Real &tol )
const
{
45
46
47
PV
&Hv_pv =
dynamic_cast<
PV
&
>
(Hv);
48
const
PV
&v_pv =
dynamic_cast<
const
PV
&
>
(v);
49
50
ROL::Ptr<V> Hv1 = Hv_pv.get(0);
51
ROL::Ptr<V> Hv2 = Hv_pv.get(1);
52
ROL::Ptr<const V> v1 = v_pv.get(0);
53
ROL::Ptr<const V> v2 = v_pv.get(1);
54
55
A_
->apply(*Hv1,*v1,tol);
56
D_
->apply(*Hv2,*v2,tol);
57
58
}
59
60
61
void
applyInverse
(
V
&Hv,
const
V
&v Real &tol )
const
{
62
63
64
PV
&Hv_pv =
dynamic_cast<
PV
&
>
(Hv);
65
const
PV
&v_pv =
dynamic_cast<
const
PV
&
>
(v);
66
67
ROL::Ptr<V> Hv1 = Hv_pv.get(0);
68
ROL::Ptr<V> Hv2 = Hv_pv.get(1);
69
ROL::Ptr<const V> v1 = v_pv.get(0);
70
ROL::Ptr<const V> v2 = v_pv.get(1);
71
72
A_
->applyInverse(*Hv1,*v1,tol);
73
D_
->applyInverse(*Hv2,*v2,tol);
74
75
}
76
77
ROL::Ptr<LinearOperator<Real> >
getOperator
(
int
row,
int
col )
const
{
78
if
( row == 0 && col == 0 ) {
79
return
A_
;
80
}
81
else
if
( row == 1 && col == 1 ) {
82
return
D_
;
83
}
84
else
{
85
ROL_TEST_FOR_EXCEPTION(
true
, std::invalid_argument,
86
">>> ERROR (ROL_BlockOperator2Diagonal, getOperator): "
87
"invalid block indices."
);
88
}
89
90
}
91
92
93
};
// class BlockOperator2Diagonal
94
95
}
// namespace ROL
96
97
#endif
// ROL_BLOCKOPERATOR2DIAGONAL_H
A_
ROL::Ptr< OP > A_
Definition
ROL_BlockOperator2Diagonal.hpp:52
V
Vector< Real > V
Definition
ROL_BlockOperator2Diagonal.hpp:46
PV
PartitionedVector< Real > PV
Definition
ROL_BlockOperator2Diagonal.hpp:47
D_
ROL::Ptr< OP > D_
Definition
ROL_BlockOperator2Diagonal.hpp:52
ROL_BlockOperator2.hpp
ROL::BlockOperator2Diagonal::A_
ROL::Ptr< OP > A_
Definition
ROL_BlockOperator2Diagonal.hpp:36
ROL::BlockOperator2Diagonal::PV
PartitionedVector< Real > PV
Definition
ROL_BlockOperator2Diagonal.hpp:31
ROL::BlockOperator2Diagonal::V
Vector< Real > V
Definition
ROL_BlockOperator2Diagonal.hpp:30
ROL::BlockOperator2Diagonal::OP
LinearOperator< Real > OP
Definition
ROL_BlockOperator2Diagonal.hpp:32
ROL::BlockOperator2Diagonal::D_
ROL::Ptr< OP > D_
Definition
ROL_BlockOperator2Diagonal.hpp:36
ROL::BlockOperator2Diagonal::BlockOperator2Diagonal
BlockOperator2Diagonal(ROL::Ptr< OP > &A, ROL::Ptr< OP > &D)
Definition
ROL_BlockOperator2Diagonal.hpp:40
ROL::BlockOperator2::BlockOperator2
BlockOperator2(ROL::Ptr< OP > &a11, ROL::Ptr< OP > &a12, ROL::Ptr< OP > &a21, ROL::Ptr< OP > &a22)
Definition
ROL_BlockOperator2.hpp:39
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