scs 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/lib/scs/ffi.rb +18 -0
- data/lib/scs/version.rb +1 -1
- data/vendor/scs/CITATION.cff +2 -3
- data/vendor/scs/CLAUDE.md +115 -0
- data/vendor/scs/CMakeLists.txt +330 -201
- data/vendor/scs/CONTRIBUTING.md +49 -0
- data/vendor/scs/Makefile +90 -43
- data/vendor/scs/README.md +96 -2
- data/vendor/scs/include/aa.h +59 -11
- data/vendor/scs/include/aa_stats.h +47 -0
- data/vendor/scs/include/cones.h +16 -7
- data/vendor/scs/include/glbopts.h +113 -26
- data/vendor/scs/include/linalg.h +5 -1
- data/vendor/scs/include/linsys.h +1 -2
- data/vendor/scs/include/normalize.h +6 -2
- data/vendor/scs/include/rw.h +9 -3
- data/vendor/scs/include/scs.h +17 -1
- data/vendor/scs/include/scs_blas.h +8 -0
- data/vendor/scs/include/scs_types.h +2 -2
- data/vendor/scs/include/scs_work.h +22 -1
- data/vendor/scs/include/util.h +3 -6
- data/vendor/scs/include/util_spectral_cones.h +3 -3
- data/vendor/scs/linsys/accelerate/direct/private.c +126 -0
- data/vendor/scs/linsys/accelerate/direct/private.h +34 -0
- data/vendor/scs/linsys/cpu/dense/private.c +250 -0
- data/vendor/scs/linsys/cpu/dense/private.h +31 -0
- data/vendor/scs/linsys/cpu/direct/private.c +86 -44
- data/vendor/scs/linsys/cpu/indirect/private.c +647 -113
- data/vendor/scs/linsys/cpu/indirect/private.h +28 -0
- data/vendor/scs/linsys/csparse.c +9 -3
- data/vendor/scs/linsys/csparse.h +4 -2
- data/vendor/scs/linsys/cudss/direct/private.c +77 -43
- data/vendor/scs/linsys/cudss/direct/private.h +33 -7
- data/vendor/scs/linsys/gpu/indirect/private.c +6 -2
- data/vendor/scs/linsys/mkl/direct/private.c +63 -31
- data/vendor/scs/linsys/mkl/direct/private.h +0 -1
- data/vendor/scs/linsys/scs_matrix.c +291 -165
- data/vendor/scs/linsys/scs_matrix.h +7 -9
- data/vendor/scs/scs.mk +35 -13
- data/vendor/scs/src/aa.c +673 -166
- data/vendor/scs/src/cones.c +545 -223
- data/vendor/scs/src/ctrlc.c +59 -16
- data/vendor/scs/src/exp_cone.c +70 -50
- data/vendor/scs/src/linalg.c +21 -2
- data/vendor/scs/src/normalize.c +24 -26
- data/vendor/scs/src/rw.c +596 -124
- data/vendor/scs/src/scs.c +990 -513
- data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_IPM.c +240 -187
- data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_Newton.c +108 -85
- data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_wrapper.c +62 -63
- data/vendor/scs/src/spectral_cones/logdeterminant/logdet_cone.c +85 -78
- data/vendor/scs/src/spectral_cones/nuclear/ell1_cone.c +92 -97
- data/vendor/scs/src/spectral_cones/nuclear/nuclear_cone.c +39 -28
- data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_cone.c +59 -40
- data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_eval_cone.c +37 -29
- data/vendor/scs/src/spectral_cones/util_spectral_cones.c +12 -6
- data/vendor/scs/src/util.c +37 -7
- data/vendor/scs/test/mkl_interface_mismatch.c +97 -0
- data/vendor/scs/test/packaging/CMakeLists.txt +21 -0
- data/vendor/scs/test/packaging/consume.c +50 -0
- data/vendor/scs/test/problem_utils.h +9 -2
- data/vendor/scs/test/problems/dense_qp.h +64 -0
- data/vendor/scs/test/problems/hs21_tiny_qp.h +6 -2
- data/vendor/scs/test/problems/hs21_tiny_qp_rw.h +10 -2
- data/vendor/scs/test/problems/infeasible_lp.h +66 -0
- data/vendor/scs/test/problems/infeasible_socp.h +75 -0
- data/vendor/scs/test/problems/lp_update.h +110 -0
- data/vendor/scs/test/problems/qafiro_tiny_qp.h +3 -1
- data/vendor/scs/test/problems/rob_gauss_cov_est.h +6 -3
- data/vendor/scs/test/problems/small_qp.h +5 -0
- data/vendor/scs/test/problems/test_box_cone.h +92 -0
- data/vendor/scs/test/problems/test_dual_exp_cone.h +96 -0
- data/vendor/scs/test/problems/test_inaccurate.h +212 -0
- data/vendor/scs/test/problems/test_mixed_cones.h +113 -0
- data/vendor/scs/test/problems/test_normalize_roundtrip.h +279 -0
- data/vendor/scs/test/problems/test_power_cone.h +414 -0
- data/vendor/scs/test/problems/test_psd_metric.h +109 -0
- data/vendor/scs/test/problems/test_psd_n1.h +84 -0
- data/vendor/scs/test/problems/test_root_plus.h +191 -0
- data/vendor/scs/test/problems/test_rw_settings.h +112 -0
- data/vendor/scs/test/problems/test_soc_sizes.h +393 -0
- data/vendor/scs/test/problems/test_solver_options.h +558 -0
- data/vendor/scs/test/problems/test_validation.h +263 -24
- data/vendor/scs/test/problems/test_zero_cone.h +81 -0
- data/vendor/scs/test/problems/unbounded_lp.h +66 -0
- data/vendor/scs/test/problems/unbounded_socp.h +71 -0
- data/vendor/scs/test/run_from_file.c +6 -0
- data/vendor/scs/test/run_tests.c +71 -0
- data/vendor/scs/test/rw_settings.c +7 -0
- data/vendor/scs/test/spectral_cones_problems/test_ell1_and_nuc.h +128 -0
- data/vendor/scs/test/spectral_cones_problems/test_ell1_cone.h +115 -0
- metadata +35 -3
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Sparse matrix operations: normalization/equilibration, copying, validation,
|
|
3
|
+
* and matrix-vector products (A*x, A'*x, P*x) for CSC-format matrices.
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
#ifndef SCS_MATRIX_H_GUARD
|
|
2
7
|
#define SCS_MATRIX_H_GUARD
|
|
3
8
|
|
|
@@ -6,19 +11,14 @@ extern "C" {
|
|
|
6
11
|
#endif
|
|
7
12
|
|
|
8
13
|
#include "glbopts.h"
|
|
9
|
-
#include "scs.h"
|
|
10
14
|
#include "scs_work.h"
|
|
11
15
|
|
|
12
16
|
/* Normalization routines, used if d->NORMALIZE is true */
|
|
13
17
|
/* normalizes A matrix, sets scal->E and scal->D diagonal scaling matrices,
|
|
14
18
|
* A -> D*A*E. D and E must be all positive entries, D must satisfy cone
|
|
15
19
|
* boundaries */
|
|
16
|
-
ScsScaling *SCS(normalize_a_p)(ScsMatrix *P, ScsMatrix *A,
|
|
17
|
-
|
|
18
|
-
/* unnormalizes A matrix, unnormalizes by w->D and w->E */
|
|
19
|
-
/* void SCS(un_normalize_a_p)(ScsMatrix *A, ScsMatrix *P, const ScsScaling
|
|
20
|
-
* *scal);
|
|
21
|
-
*/
|
|
20
|
+
ScsScaling *SCS(normalize_a_p)(ScsMatrix *P, ScsMatrix *A, const scs_float *b,
|
|
21
|
+
const scs_float *c, ScsConeWork *cone);
|
|
22
22
|
|
|
23
23
|
/* to free the memory allocated in a ScsMatrix (called on A and P at finish) */
|
|
24
24
|
void SCS(free_scs_matrix)(ScsMatrix *A);
|
|
@@ -27,8 +27,6 @@ void SCS(free_scs_matrix)(ScsMatrix *A);
|
|
|
27
27
|
* allocates memory for dstp */
|
|
28
28
|
scs_int SCS(copy_matrix)(ScsMatrix **dstp, const ScsMatrix *src);
|
|
29
29
|
|
|
30
|
-
scs_float SCS(cumsum)(scs_int *p, scs_int *c, scs_int n);
|
|
31
|
-
|
|
32
30
|
/**
|
|
33
31
|
* Validate the linear system inputs, returns < 0 if not valid inputs.
|
|
34
32
|
*
|
data/vendor/scs/scs.mk
CHANGED
|
@@ -4,10 +4,8 @@ else
|
|
|
4
4
|
UNAME = $(shell uname -s)
|
|
5
5
|
endif
|
|
6
6
|
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#CC = i686-w64-mingw32-gcc -m32
|
|
10
|
-
#CC = x86_64-w64-mingw32-gcc-4.8
|
|
7
|
+
# To enable sanitizers or cross-compile, override CC on the command line:
|
|
8
|
+
# make CC="clang -fsanitize=address,undefined"
|
|
11
9
|
|
|
12
10
|
# For GPU must add cuda libs to path, e.g.
|
|
13
11
|
# export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
|
|
@@ -30,26 +28,37 @@ endif
|
|
|
30
28
|
endif
|
|
31
29
|
endif
|
|
32
30
|
|
|
31
|
+
# ABI version embedded in the shared-library soname/install_name, derived from
|
|
32
|
+
# SCS_VERSION (keep project() in CMakeLists.txt in step). Bump on ABI breaks,
|
|
33
|
+
# never on patch releases.
|
|
34
|
+
SCS_SOVERSION := $(shell awk -F'"' '/define SCS_VERSION/ {split($$2, v, "."); print v[1] "." v[2]}' include/glbopts.h)
|
|
35
|
+
|
|
36
|
+
# versioned(name): the file a shared library is linked as; the unversioned
|
|
37
|
+
# name becomes a symlink to it (libscsdir.so.3.3, libscsdir.3.3.dylib).
|
|
38
|
+
# Windows DLLs stay unversioned.
|
|
33
39
|
ifeq ($(UNAME), Darwin)
|
|
34
40
|
# we're on apple, no need to link rt library
|
|
35
41
|
LDFLAGS += -lm
|
|
36
42
|
SHARED = dylib
|
|
37
43
|
SONAME = -install_name
|
|
44
|
+
versioned = $(1:%.dylib=%.$(SCS_SOVERSION).dylib)
|
|
38
45
|
else
|
|
39
46
|
ifeq ($(ISWINDOWS), 1)
|
|
40
47
|
# we're on windows (cygwin or msys)
|
|
41
48
|
LDFLAGS += -lm
|
|
42
49
|
SHARED = dll
|
|
43
50
|
SONAME = -soname
|
|
51
|
+
versioned = $(1)
|
|
44
52
|
else
|
|
45
53
|
# we're on a linux system, use accurate timer provided by clock_gettime()
|
|
46
|
-
LDFLAGS += -lm -lrt
|
|
54
|
+
LDFLAGS += -lm -lrt -lpthread
|
|
47
55
|
SHARED = so
|
|
48
56
|
SONAME = -soname
|
|
57
|
+
versioned = $(1:%.so=%.so.$(SCS_SOVERSION))
|
|
49
58
|
endif
|
|
50
59
|
endif
|
|
51
60
|
|
|
52
|
-
#
|
|
61
|
+
# Default CUDA path; override with CUDA_PATH=/path/to/cuda
|
|
53
62
|
ifeq ($(CUDA_PATH), )
|
|
54
63
|
CUDA_PATH=/usr/local/cuda
|
|
55
64
|
CUCC = $(CUDA_PATH)/bin/nvcc
|
|
@@ -61,8 +70,9 @@ CUDAFLAGS = $(CFLAGS) -I$(CUDA_PATH)/include -Ilinsys/gpu -Wno-c++11-long-long #
|
|
|
61
70
|
CUDSS_FLAGS = -I$(CUDSS_PATH)/include -I$(CUDA_PATH)/include
|
|
62
71
|
CUDSS_LDFLAGS = $(CULDFLAGS) -L$(CUDSS_PATH)/lib -lcudss
|
|
63
72
|
|
|
64
|
-
#
|
|
65
|
-
|
|
73
|
+
# Default optimization flags. Override with OPT="-O3 -g" for valgrind, which
|
|
74
|
+
# may not support instruction sets enabled by -march=native.
|
|
75
|
+
OPT ?= -O3 -march=native -fno-math-errno
|
|
66
76
|
INCLUDE = -I. -Iinclude -Ilinsys
|
|
67
77
|
override CFLAGS += -g -Wall -Wwrite-strings -pedantic -funroll-loops -Wstrict-prototypes $(INCLUDE) $(OPT) -Werror=incompatible-pointer-types
|
|
68
78
|
ifneq ($(ISWINDOWS), 1)
|
|
@@ -72,10 +82,12 @@ endif
|
|
|
72
82
|
LINSYS = linsys
|
|
73
83
|
DIRSRC = $(LINSYS)/cpu/direct
|
|
74
84
|
INDIRSRC = $(LINSYS)/cpu/indirect
|
|
85
|
+
DENSESRC = $(LINSYS)/cpu/dense
|
|
75
86
|
GPUDIR = $(LINSYS)/gpu/direct
|
|
76
87
|
GPUINDIR = $(LINSYS)/gpu/indirect
|
|
77
88
|
MKLSRC = $(LINSYS)/mkl/direct
|
|
78
89
|
CUDSSSRC = $(LINSYS)/cudss/direct
|
|
90
|
+
ACCELSRC = $(LINSYS)/accelerate/direct
|
|
79
91
|
|
|
80
92
|
EXTSRC = $(LINSYS)/external
|
|
81
93
|
|
|
@@ -124,7 +136,7 @@ CUSTOM_FLAGS += -DNO_PRINTING=$(NO_PRINTING) # disable printing
|
|
|
124
136
|
endif
|
|
125
137
|
NO_READ_WRITE = 0
|
|
126
138
|
ifneq ($(NO_READ_WRITE), 0)
|
|
127
|
-
CUSTOM_FLAGS += -DNO_READ_WRITE=$(NO_READ_WRITE) # disable
|
|
139
|
+
CUSTOM_FLAGS += -DNO_READ_WRITE=$(NO_READ_WRITE) # disable read/write (file I/O)
|
|
128
140
|
endif
|
|
129
141
|
### VERBOSITY LEVELS: 0,1,2,...
|
|
130
142
|
VERBOSITY = 0
|
|
@@ -136,10 +148,20 @@ ifneq ($(COVERAGE), 0)
|
|
|
136
148
|
CUSTOM_FLAGS += --coverage # generate test coverage data
|
|
137
149
|
endif
|
|
138
150
|
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
142
|
-
|
|
151
|
+
# MKL linker flags for Linux + GCC + GNU threading. For other platforms, see:
|
|
152
|
+
# https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html
|
|
153
|
+
#
|
|
154
|
+
# We link against mkl_rt (the single dynamic library) which dispatches to the
|
|
155
|
+
# correct interface layer at runtime. The BLAS integer width (LP64 vs ILP64)
|
|
156
|
+
# is set at startup by the MKL-specific path in src/scs.c, controlled by the
|
|
157
|
+
# BLAS64 compile flag.
|
|
158
|
+
#
|
|
159
|
+
# Note: The PARDISO integer width (pardiso vs pardiso_64) is controlled by DLONG,
|
|
160
|
+
# not by the MKL interface layer. See linsys/mkl/direct/private.c for details.
|
|
161
|
+
# OMPROOT should point to the Intel OpenMP (iomp5) installation, typically
|
|
162
|
+
# /opt/intel/oneapi/compiler/latest. If unset, fall back to MKLROOT.
|
|
163
|
+
OMPROOT ?= $(MKLROOT)
|
|
164
|
+
MKLFLAGS = -L$(MKLROOT)/lib -L$(MKLROOT)/lib/intel64 -L$(OMPROOT)/lib -Wl,--no-as-needed -lmkl_rt -liomp5 -lpthread -ldl
|
|
143
165
|
|
|
144
166
|
############ OPENMP: ############
|
|
145
167
|
# set USE_OPENMP = 1 to allow openmp (multi-threaded matrix multiplies):
|