ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
function
operator
ROL_BlockOperator2.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_BLOCKOPERATOR2_H
11
#define ROL_BLOCKOPERATOR2_H
12
13
#include "
ROL_BlockOperator.hpp
"
14
22
23
namespace
ROL
{
24
25
template
<
class
Real>
26
class
BlockOperator2
:
public
LinearOperator
<Real> {
27
28
typedef
Vector<Real>
V
;
// ROL Vector
29
typedef
PartitionedVector<Real>
PV
;
// ROL PartitionedVector
30
typedef
LinearOperator<Real>
OP
;
// Linear Operator
31
32
private
:
33
34
ROL::Ptr<OP>
bkop_
;
35
ROL::Ptr<std::vector<ROL::Ptr<OP> > >
ops_
;
36
37
public
:
38
39
BlockOperator2
( ROL::Ptr<OP> &a11, ROL::Ptr<OP> &a12,
40
ROL::Ptr<OP> &a21, ROL::Ptr<OP> &a22 ) {
41
42
using
std::vector;
43
44
45
46
ops_
= ROL::makePtr<vector<ROL::Ptr<OP> >>();
47
ops_
->push_back(a11);
48
ops_
->push_back(a12);
49
ops_
->push_back(a21);
50
ops_
->push_back(a22);
51
52
bkop_
= ROL::makePtr<BlockOperator<Real>>(
ops_
);
53
54
}
55
56
57
void
apply
(
V
&Hv,
const
V
&v, Real &tol )
const
{
58
bkop_
->apply(Hv,v,tol);
59
}
60
61
62
void
applyInverse
(
V
&Hv,
const
V
&v, Real &tol )
const
{
63
64
ROL_TEST_FOR_EXCEPTION(
true
, std::logic_error,
65
">>> ERROR (ROL_BlockOperator2, applyInverse): "
66
"Not implemented."
);
67
68
}
69
70
ROL::Ptr<LinearOperator<Real> >
getOperator
(
int
row,
int
col )
const
{
71
int
dex = 2*row+col;
72
if
( 0<=dex && dex<=3 ) {
73
return
(*
ops_
)[dex];
74
}
75
else
{
76
ROL_TEST_FOR_EXCEPTION(
true
, std::invalid_argument,
77
">>> ERROR (ROL_BlockOperator2, getOperator): "
78
"invalid block indices."
);
79
}
80
81
}
82
83
84
};
// class BlockOperator2
85
86
}
// namespace ROL
87
88
#endif
// ROL_BLOCKOPERATOR2_H
ROL_BlockOperator.hpp
ROL::BlockOperator2::PV
PartitionedVector< Real > PV
Definition
ROL_BlockOperator2.hpp:29
ROL::BlockOperator2::OP
LinearOperator< Real > OP
Definition
ROL_BlockOperator2.hpp:30
ROL::BlockOperator2::applyInverse
void applyInverse(V &Hv, const V &v, Real &tol) const
Definition
ROL_BlockOperator2.hpp:62
ROL::BlockOperator2::bkop_
ROL::Ptr< OP > bkop_
Definition
ROL_BlockOperator2.hpp:34
ROL::BlockOperator2::getOperator
ROL::Ptr< LinearOperator< Real > > getOperator(int row, int col) const
Definition
ROL_BlockOperator2.hpp:70
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::BlockOperator2::apply
void apply(V &Hv, const V &v, Real &tol) const
Definition
ROL_BlockOperator2.hpp:57
ROL::BlockOperator2::V
Vector< Real > V
Definition
ROL_BlockOperator2.hpp:28
ROL::BlockOperator2::ops_
ROL::Ptr< std::vector< ROL::Ptr< OP > > > ops_
Definition
ROL_BlockOperator2.hpp:35
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
Generated by
1.17.0