EigenOpt 1.0.0
Loading...
Searching...
No Matches
quadratic_programming_debug.hpp
Go to the documentation of this file.
1#pragma once
2
3// EigenOpt_QUADPROG_HIGHVIS_MSG() is meant for temporary debug statements.
4// They can be helpful to pinpoint an issue, but they should later be removed
5// from the code.
6#define EigenOpt_QUADPROG_HIGHVIS_MSG(x) {std::cout << "\033[33m[DBG] " << x << "\033[m" << std::endl;}
7
8
9#ifdef EigenOpt_QUADPROG_DEBUG_ON
10 #include <iostream>
11
12 // EigenOpt_QUADPROG_DBG() is meant for "long-term" debug statements, i.e.,
13 // messages that will be left in the code even after testing.
14 #ifndef EigenOpt_QUADPROG_SILENCE_DBG
15 #define EigenOpt_QUADPROG_DBG(x) {std::cout << "[DBG] " << x << std::endl;}
16 #else
17 #define EigenOpt_QUADPROG_DBG(x) ;
18 #endif
19
20 namespace EigenOpt {
21 namespace quadratic_programming {
22 namespace internal {
23 template<class T>
24 std::string vec2str(const std::vector<T>& v) {
25 std::stringstream ss;
26 for(const auto& e : v)
27 ss << " " << e;
28 return ss.str();
29 }
30 } // namespace internal
31 } // namespace quadratic_programming
32 } // namespace EigenOpt
33
34 #ifdef EigenOpt_QUADPROG_BREAKPOINTS_ON
35 namespace EigenOpt {
36 namespace quadratic_programming {
37 namespace internal {
38 void breakpoint() {
39 std::string foo;
40 std::cout << "Press enter to proceed ";
41 std::cin >> foo;
42 }
43 } // namespace internal
44 } // namespace quadratic_programming
45 } // namespace EigenOpt
46 #define EigenOpt_QUADPROG_BREAK EigenOpt::quadratic_programming::internal::breakpoint();
47 #else
48 #define EigenOpt_QUADPROG_BREAK ;
49 #endif
50#else
51 #define EigenOpt_QUADPROG_DBG(x) ;
52 #define EigenOpt_QUADPROG_BREAK ;
53#endif
Main namespace of this project, containing all utilities.