-
Notifications
You must be signed in to change notification settings - Fork 3
/
LbfgsUtils.h
126 lines (120 loc) · 3.27 KB
/
LbfgsUtils.h
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#ifndef _LBFGS_UTILS_H_
#define _LBFGS_UTILS_H_
#include <string>
#include <vector>
#include <sstream>
#include <set>
#include <lbfgs.h>
typedef std::string string;
typedef std::stringstream stringstream;
class LbfgsUtils {
public:
// returns a string indicating the LBFGS status code
static string LbfgsStatusIntToString(int status) {
switch(status) {
case LBFGS_SUCCESS:
return "LBFGS_SUCCESS";
break;
case LBFGSERR_UNKNOWNERROR:
return "LBFGSERR_UNKNOWNERROR";
break;
case LBFGS_ALREADY_MINIMIZED:
return "LBFGS_ALREADY_MINIMIZED";
break;
case LBFGSERR_LOGICERROR:
return "LBFGSERR_LOGICERROR";
break;
case LBFGSERR_OUTOFMEMORY:
return "LBFGSERR_OUTOFMEMORY";
break;
case LBFGSERR_CANCELED:
return "LBFGSERR_CANCELED";
break;
case LBFGSERR_INVALID_N:
return "LBFGSERR_INVALID_N";
break;
case LBFGSERR_INVALID_N_SSE:
return "LBFGSERR_INVALID_N_SSE";
break;
case LBFGSERR_INVALID_X_SSE:
return "LBFGSERR_INVALID_X_SSE";
break;
case LBFGSERR_INVALID_EPSILON:
return "LBFGSERR_INVALID_EPSILON";
break;
case LBFGSERR_INVALID_TESTPERIOD:
return "LBFGSERR_INVALID_TESTPERIOD";
break;
case LBFGSERR_INVALID_DELTA:
return "LBFGSERR_INVALID_DELTA";
break;
case LBFGSERR_INVALID_LINESEARCH:
return "LBFGSERR_INVALID_LINESEARCH";
break;
case LBFGSERR_INVALID_MINSTEP:
return "LBFGSERR_INVALID_MINSTEP";
break;
case LBFGSERR_INVALID_MAXSTEP:
return "LBFGSERR_INVALID_MAXSTEP";
break;
case LBFGSERR_INVALID_FTOL:
return "LBFGSERR_INVALID_FTOL";
break;
case LBFGSERR_INVALID_WOLFE:
return "LBFGSERR_INVALID_WOLFE";
break;
case LBFGSERR_INVALID_GTOL:
return "LBFGSERR_INVALID_GTOL";
break;
case LBFGSERR_INVALID_XTOL:
return "LBFGSERR_INVALID_XTOL";
break;
case LBFGSERR_INVALID_MAXLINESEARCH:
return "LBFGSERR_INVALID_MAXLINESEARCH";
break;
case LBFGSERR_INVALID_ORTHANTWISE:
return "LBFGSERR_INVALID_ORTHANTWISE";
break;
case LBFGSERR_INVALID_ORTHANTWISE_START:
return "LBFGSERR_INVALID_ORTHANTWISE_START";
break;
case LBFGSERR_INVALID_ORTHANTWISE_END:
return "LBFGSERR_INVALID_ORTHANTWISE_END";
break;
case LBFGSERR_OUTOFINTERVAL:
return "LBFGSERR_OUTOFINTERVAL";
break;
case LBFGSERR_INCORRECT_TMINMAX:
return "LBFGSERR_INCORRECT_TMINMAX";
break;
case LBFGSERR_ROUNDING_ERROR:
return "LBFGSERR_ROUNDING_ERROR";
break;
case LBFGSERR_MINIMUMSTEP:
return "LBFGSERR_MINIMUMSTEP";
break;
case LBFGSERR_MAXIMUMSTEP:
return "LBFGSERR_MAXIMUMSTEP";
break;
case LBFGSERR_MAXIMUMLINESEARCH:
return "LBFGSERR_MAXIMUMLINESEARCH";
break;
case LBFGSERR_MAXIMUMITERATION:
return "LBFGSERR_MAXIMUMITERATION";
break;
case LBFGSERR_WIDTHTOOSMALL:
return "LBFGSERR_WIDTHTOOSMALL";
break;
case LBFGSERR_INVALIDPARAMETERS:
return "LBFGSERR_INVALIDPARAMETERS";
break;
case LBFGSERR_INCREASEGRADIENT:
return "LBFGSERR_INCREASEGRADIENT";
break;
default:
return "THIS IS NOT A VALID LBFGS STATUS CODE";
break;
}
}
};
#endif