-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathISAM2CopyParams.cpp
90 lines (75 loc) · 2.51 KB
/
ISAM2CopyParams.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
/**
* @file ISAM2CopyParams.cpp
* @brief Parameters for iSAM 2.
* @author Michael Kaess, Richard Roberts, Frank Dellaert
*/
#include "ISAM2CopyParams.h"
#include <boost/algorithm/string.hpp>
using namespace std;
namespace gtsam {
/* ************************************************************************* */
string ISAM2CopyDoglegParams::adaptationModeTranslator(
const DoglegOptimizerImpl::TrustRegionAdaptationMode& adaptationMode)
const {
string s;
switch (adaptationMode) {
case DoglegOptimizerImpl::SEARCH_EACH_ITERATION:
s = "SEARCH_EACH_ITERATION";
break;
case DoglegOptimizerImpl::ONE_STEP_PER_ITERATION:
s = "ONE_STEP_PER_ITERATION";
break;
default:
s = "UNDEFINED";
break;
}
return s;
}
/* ************************************************************************* */
DoglegOptimizerImpl::TrustRegionAdaptationMode
ISAM2CopyDoglegParams::adaptationModeTranslator(
const string& adaptationMode) const {
string s = adaptationMode;
boost::algorithm::to_upper(s);
if (s == "SEARCH_EACH_ITERATION")
return DoglegOptimizerImpl::SEARCH_EACH_ITERATION;
if (s == "ONE_STEP_PER_ITERATION")
return DoglegOptimizerImpl::ONE_STEP_PER_ITERATION;
/* default is SEARCH_EACH_ITERATION */
return DoglegOptimizerImpl::SEARCH_EACH_ITERATION;
}
/* ************************************************************************* */
ISAM2CopyParams::Factorization ISAM2CopyParams::factorizationTranslator(
const string& str) {
string s = str;
boost::algorithm::to_upper(s);
if (s == "QR") return ISAM2CopyParams::QR;
if (s == "CHOLESKY") return ISAM2CopyParams::CHOLESKY;
/* default is CHOLESKY */
return ISAM2CopyParams::CHOLESKY;
}
/* ************************************************************************* */
string ISAM2CopyParams::factorizationTranslator(
const ISAM2CopyParams::Factorization& value) {
string s;
switch (value) {
case ISAM2CopyParams::QR:
s = "QR";
break;
case ISAM2CopyParams::CHOLESKY:
s = "CHOLESKY";
break;
default:
s = "UNDEFINED";
break;
}
return s;
}
} // namespace gtsam