QPALM
A proximal augmented Lagrangian method for QPs.
util.h
Go to the documentation of this file.
1 
8 #ifndef UTIL_H
9 #define UTIL_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif // ifdef __cplusplus
14 
15 #include "types.h"
16 #include "constants.h"
17 
18 
19 /**********************
20 * Utility Functions *
21 **********************/
22 
29 QPALMSettings* copy_settings(const QPALMSettings *settings);
30 
31 
37 void c_strcpy(char dest[],
38  const char source[]);
39 
40 
46 void update_status(QPALMInfo *info,
47  c_int status_val);
48 
49 
50 /**********************
51 * Print Functions *
52 **********************/
53 
54 #ifdef PRINTING
55 
59 void print_header(void);
60 
66 void print_iteration(c_int iter, QPALMWorkspace *work);
67 
73 
74 #endif //PRINTING
75 
76 
77 /*********************************
78 * Timer Structs and Functions * *
79 *********************************/
80 
83 # ifdef PROFILING
84 
85 // Windows
86 # ifdef _WIN32
87 
88  // Some R packages clash with elements
89  // of the windows.h header, so use a
90  // slimmer version for conflict avoidance
91  # ifdef R_LANG
92  #define NOGDI
93  # endif
94 
95 # include <windows.h>
96 
97 struct QPALM_TIMER {
98  LARGE_INTEGER tic;
99  LARGE_INTEGER toc;
100  LARGE_INTEGER freq;
101 };
102 
103 // Mac
104 # elif defined __APPLE__
105 
106 # include <mach/mach_time.h>
107 
108 /* Use MAC OSX mach_time for timing */
109 struct QPALM_TIMER {
110  uint64_t tic;
111  uint64_t toc;
112  mach_timebase_info_data_t tinfo;
113 };
114 
115 // Mac
116 # elif defined __MACH__
117 
118 # include <mach/mach_time.h>
119 
120 /* Use MAC OSX mach_time for timing */
121 struct QPALM_TIMER {
122  uint64_t tic;
123  uint64_t toc;
124  mach_timebase_info_data_t tinfo;
125 };
126 
127 // Linux
128 # elif defined __linux__ // ifdef _WIN32
129 
130 # include <time.h>
131 # include <sys/time.h>
132 
133 struct QPALM_TIMER {
134  struct timespec tic;
135  struct timespec toc;
136 };
137 
138 # endif // ifdef _WIN32
139 
147 void qpalm_tic(QPALMTimer *t);
148 
155 
156 # endif /* END #ifdef PROFILING */
157 
158 
159 # ifdef __cplusplus
160 }
161 # endif // ifdef __cplusplus
162 
163 #endif // ifndef UTIL_H
void print_final_message(QPALMWorkspace *work)
Print final message as a box with info.
Definition: util.c:121
Internal data structures used in QPALM.
Constants used in QPALM.
void update_status(QPALMInfo *info, c_int status_val)
Update solver status (value and string).
Definition: util.c:61
Settings struct.
Definition: types.h:119
void qpalm_tic(QPALMTimer *t)
Start timer.
c_float qpalm_toc(QPALMTimer *t)
Report time in seconds since last call to qpalm_tic.
QPALM Workspace.
Definition: types.h:197
void c_strcpy(char dest[], const char source[])
Custom string copy to avoid string.h library.
Definition: util.c:18
void print_header(void)
Print the header with QPALM version number and fields.
Definition: util.c:107
void print_iteration(c_int iter, QPALMWorkspace *work)
Print information about the current iteration.
Definition: util.c:113
struct QPALM_TIMER QPALMTimer
QPALM Timer for statistics.
Definition: types.h:58
QPALMSettings * copy_settings(const QPALMSettings *settings)
Copy settings creating a new settings structure.
Definition: util.c:24
ladel_int c_int
type for integer numbers
Definition: global_opts.h:22
Solver return information.
Definition: types.h:76
ladel_double c_float
type for floating point numbers
Definition: global_opts.h:21