ROL
Toggle main menu visibility
Loading...
Searching...
No Matches
src
step
secant
ROL_SecantFactory.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_SECANTFACTORY_H
11
#define ROL_SECANTFACTORY_H
12
13
#include "
ROL_Types.hpp
"
14
15
#include "ROL_ParameterList.hpp"
16
#include "ROL_Ptr.hpp"
17
18
#include "
ROL_Secant.hpp
"
19
#include "
ROL_lBFGS.hpp
"
20
#include "
ROL_lDFP.hpp
"
21
#include "
ROL_lSR1.hpp
"
22
#include "
ROL_BarzilaiBorwein.hpp
"
23
24
namespace
ROL
{
25
template
<
class
Real>
26
inline
ROL::Ptr<Secant<Real> >
getSecant
(
ESecant
esec =
SECANT_LBFGS
,
int
L = 10,
int
BBtype = 1 ) {
27
switch
(esec) {
28
case
SECANT_LBFGS
:
return
ROL::makePtr<lBFGS<Real>>(L);
29
case
SECANT_LDFP
:
return
ROL::makePtr<lDFP<Real>>(L);
30
case
SECANT_LSR1
:
return
ROL::makePtr<lSR1<Real>>(L);
31
case
SECANT_BARZILAIBORWEIN
:
return
ROL::makePtr<BarzilaiBorwein<Real>>(BBtype);
32
default
:
return
ROL::nullPtr;
33
}
34
}
35
36
template
<
class
Real>
37
inline
ROL::Ptr<Secant<Real> >
SecantFactory
( ROL::ParameterList &parlist,
ESecantMode
mode =
SECANTMODE_BOTH
) {
38
std::string secantName = parlist.sublist(
"General"
).sublist(
"Secant"
).get(
"Type"
,
"Limited-Memory BFGS"
);
39
ESecant
esec =
StringToESecant
(secantName);
40
int
L = parlist.sublist(
"General"
).sublist(
"Secant"
).get(
"Maximum Storage"
,10);
41
int
BB = parlist.sublist(
"General"
).sublist(
"Secant"
).get(
"Barzilai-Borwein"
,1);
42
bool
uds = parlist.sublist(
"General"
).sublist(
"Secant"
).get(
"Use Default Scaling"
,
true
);
43
Real s = parlist.sublist(
"General"
).sublist(
"Secant"
).get(
"Initial Hessian Scale"
,1.0);
44
switch
(esec) {
45
case
SECANT_LBFGS
:
return
ROL::makePtr<lBFGS<Real>>(L,uds,s);
46
case
SECANT_LDFP
:
return
ROL::makePtr<lDFP<Real>>(L,uds,s);
47
case
SECANT_LSR1
:
return
ROL::makePtr<lSR1<Real>>(L,uds,s,mode);
48
case
SECANT_BARZILAIBORWEIN
:
return
ROL::makePtr<BarzilaiBorwein<Real>>(BB);
49
default
:
return
ROL::nullPtr;
50
}
51
}
52
}
53
54
#endif
ROL_BarzilaiBorwein.hpp
ROL_Secant.hpp
ROL_Types.hpp
Contains definitions of custom data types in ROL.
ROL_lBFGS.hpp
ROL_lDFP.hpp
ROL_lSR1.hpp
ROL
Definition
ROL_ElementwiseVector.hpp:27
ROL::StringToESecant
ESecant StringToESecant(std::string s)
Definition
ROL_Types.hpp:513
ROL::ESecant
ESecant
Definition
ROL_Types.hpp:456
ROL::SECANT_LSR1
@ SECANT_LSR1
Definition
ROL_Types.hpp:459
ROL::SECANT_LDFP
@ SECANT_LDFP
Definition
ROL_Types.hpp:458
ROL::SECANT_LBFGS
@ SECANT_LBFGS
Definition
ROL_Types.hpp:457
ROL::SECANT_BARZILAIBORWEIN
@ SECANT_BARZILAIBORWEIN
Definition
ROL_Types.hpp:460
ROL::ESecantMode
ESecantMode
Definition
ROL_Secant.hpp:23
ROL::SECANTMODE_BOTH
@ SECANTMODE_BOTH
Definition
ROL_Secant.hpp:26
ROL::SecantFactory
ROL::Ptr< Secant< Real > > SecantFactory(ROL::ParameterList &parlist, ESecantMode mode=SECANTMODE_BOTH)
Definition
ROL_SecantFactory.hpp:37
ROL::getSecant
ROL::Ptr< Secant< Real > > getSecant(ESecant esec=SECANT_LBFGS, int L=10, int BBtype=1)
Definition
ROL_SecantFactory.hpp:26
Generated by
1.17.0