glblopts.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * ECOS - Embedded Conic Solver.
  3. * Copyright (C) 2012-2015 A. Domahidi [domahidi@embotech.com],
  4. * Automatic Control Lab, ETH Zurich & embotech GmbH, Zurich, Switzerland.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /* data type definitions used with ECOS */
  20. #ifndef __GLBLOPTS_H__
  21. #define __GLBLOPTS_H__
  22. /* SET PRINT LEVEL ----------------------------------------------------- */
  23. #define PRINTLEVEL (2) /* 0: no prints */
  24. /* 1: only final info */
  25. /* 2: progress print per iteration */
  26. /* 3: debug level, enables print & dump fcns. */
  27. #define MATLAB_FLUSH_PRINTS
  28. /* print each iteration directly to Matlab. */
  29. /* this options considerably slows down the */
  30. /* solver, but is useful if you solve big */
  31. /* problems. */
  32. /* SET PROFILING LEVEL ------------------------------------------------- */
  33. #define PROFILING (1) /* 0: no timing information */
  34. /* 1: runtime (divided in setup and solve) */
  35. /* 2: detailed profiling */
  36. /* SET DEBUG LEVEL ----------------------------------------------------- */
  37. #define DEBUG (0) /* 0: no debugging information */
  38. /* 1: debug info & dump intermediate results */
  39. /* (flag used only for development) */
  40. /* DATA TYPES ---------------------------------------------------------- */
  41. #include <float.h>
  42. #include <math.h>
  43. /* NOTE: Currently, pfloat MUST be double for ecos */
  44. typedef double pfloat; /* for numerical values */
  45. #define ECOS_INFINITY (DBL_MAX + DBL_MAX)
  46. #define ECOS_NAN (ECOS_INFINITY - ECOS_INFINITY)
  47. #if defined(_MSC_VER) && (_MSC_VER < 1900)
  48. /* this will also return true if x is nan, but we don't check that anyway */
  49. #define isinf(x) (!_finite(x))
  50. #endif
  51. /* Exponential cone */
  52. #define EXPCONE /*When defined the exponential cone solver code is enabled*/
  53. /* SYSTEM INCLUDES FOR PRINTING ---------------------------------------- */
  54. #if PRINTLEVEL > 0
  55. #ifdef MATLAB_MEX_FILE
  56. #include "mex.h"
  57. #define PRINTTEXT mexPrintf
  58. // #elif defined PYTHON
  59. // #include <Python.h>
  60. // #define PRINTTEXT PySys_WriteStdout
  61. #else
  62. #define PRINTTEXT printf
  63. #endif
  64. #include <stdio.h>
  65. #else
  66. #define PRINTTEXT(...)
  67. #endif
  68. #include "SuiteSparse_config.h"
  69. /* USE SAME NUMBER REPRESENTATION FOR INDEXING AS AMD AND LDL ---------- */
  70. #if defined(DLONG) && !defined(LDL_LONG) || defined(LDL_LONG) && !defined(DLONG)
  71. #error "Inconsistent definition of DLONG and LDL_LONG"
  72. #endif
  73. #ifdef DLONG
  74. typedef SuiteSparse_long idxint;
  75. #else
  76. typedef int idxint;
  77. #endif
  78. /* SYSTEM INCLUDE IF COMPILING FOR MATLAB ------------------------------ */
  79. #ifdef MATLAB_MEX_FILE
  80. #include "mex.h"
  81. #endif
  82. /* CHOOSE RIGHT MEMORY MANAGER ----------------------------------------- */
  83. #ifdef MATLAB_MEX_FILE
  84. #define MALLOC mxMalloc
  85. #define FREE mxFree
  86. #else
  87. #define MALLOC malloc
  88. #define FREE free
  89. #endif
  90. #endif