vendor/scs/include/glbopts.h in scs-0.4.0 vs vendor/scs/include/glbopts.h in scs-0.4.1
- old
+ new
@@ -10,20 +10,21 @@
#ifndef SCS
#define SCS(x) _scs_##x
#endif
-/* SCS VERSION NUMBER ---------------------------------------------- */
+/* SCS VERSION NUMBER ---------------------------------------------- */
/* string literals automatically null-terminated */
-#define SCS_VERSION ("3.2.0")
+#define SCS_VERSION ("3.2.3")
/* verbosity level */
#ifndef VERBOSITY
#define VERBOSITY (0)
#endif
-/* DEFAULT SOLVER PARAMETERS AND SETTINGS -------------------------- */
+/* DEFAULT SOLVER PARAMETERS AND SETTINGS -------------------------- */
+/* If you update any of these you must update the documentation manually */
#define MAX_ITERS (100000)
#define EPS_REL (1E-4)
#define EPS_ABS (1E-4)
#define EPS_INFEAS (1E-7)
#define ALPHA (1.5)
@@ -37,18 +38,17 @@
#define ADAPTIVE_SCALE (1)
#define WRITE_DATA_FILENAME (0)
#define LOG_CSV_FILENAME (0)
#define TIME_LIMIT_SECS (0.)
-/* redefine printfs and memory allocators as needed */
+/* redefine printfs as needed */
+#if NO_PRINTING > 0 /* Disable all printing */
+#define scs_printf(...) /* No-op */
+#else
#ifdef MATLAB_MEX_FILE
#include "mex.h"
#define scs_printf mexPrintf
-#define scs_free mxFree
-#define scs_malloc mxMalloc
-#define scs_calloc mxCalloc
-#define scs_realloc mxRealloc
#elif defined PYTHON
#include <Python.h>
/* see:
* https://cython-users.narkive.com/jRjjs3sK/reacquire-gil-for-printing-in-wrapped-c-library
*/
@@ -56,10 +56,31 @@
{ \
PyGILState_STATE gilstate = PyGILState_Ensure(); \
PySys_WriteStdout(__VA_ARGS__); \
PyGILState_Release(gilstate); \
}
+#elif defined R_LANG
+#include <R_ext/Print.h> /* Rprintf etc */
+#include <stdio.h>
+#include <stdlib.h>
+#define scs_printf Rprintf
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#define scs_printf printf
+#endif
+#endif
+
+/* redefine memory allocators as needed */
+#ifdef MATLAB_MEX_FILE
+#include "mex.h"
+#define scs_free mxFree
+#define scs_malloc mxMalloc
+#define scs_calloc mxCalloc
+#define scs_realloc mxRealloc
+#elif defined PYTHON
+#include <Python.h>
#if PY_MAJOR_VERSION >= 3
#define scs_free PyMem_RawFree
#define scs_malloc PyMem_RawMalloc
#define scs_realloc PyMem_RawRealloc
#define scs_calloc PyMem_RawCalloc
@@ -72,22 +93,19 @@
memset(obj, 0, count * size);
return obj;
}
#endif
#elif defined R_LANG
-#include <R_ext/Print.h> /* Rprintf etc */
#include <stdio.h>
#include <stdlib.h>
-#define scs_printf Rprintf
#define scs_free free
#define scs_malloc malloc
#define scs_calloc calloc
#define scs_realloc realloc
#else
#include <stdio.h>
#include <stdlib.h>
-#define scs_printf printf
#define scs_free free
#define scs_malloc malloc
#define scs_calloc calloc
#define scs_realloc realloc
#endif
@@ -142,11 +160,12 @@
#define FEASIBLE_ITERS (1)
/* how many iterations between heuristic residual rescaling */
#define RESCALING_MIN_ITERS (100)
-#define EPS_TOL (1E-18)
-#define SAFEDIV_POS(X, Y) ((Y) < EPS_TOL ? ((X) / EPS_TOL) : (X) / (Y))
+#define _DIV_EPS_TOL (1E-18)
+#define SAFEDIV_POS(X, Y) \
+ ((Y) < _DIV_EPS_TOL ? ((X) / _DIV_EPS_TOL) : (X) / (Y))
#if VERBOSITY > 0
#define PRINT_INTERVAL (1)
#define CONVERGED_INTERVAL (1)
#else