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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributing to SCS
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to SCS! For detailed guidelines,
|
|
4
|
+
see the [contribution docs](https://www.cvxgrp.org/scs/contributing).
|
|
5
|
+
|
|
6
|
+
## Quick Start
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Build
|
|
10
|
+
make
|
|
11
|
+
|
|
12
|
+
# Build and run tests
|
|
13
|
+
make test
|
|
14
|
+
./out/run_tests_direct
|
|
15
|
+
./out/run_tests_indirect
|
|
16
|
+
|
|
17
|
+
# Build with options
|
|
18
|
+
make DLONG=1 USE_LAPACK=1
|
|
19
|
+
|
|
20
|
+
# Clean everything
|
|
21
|
+
make purge
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Development Workflow
|
|
25
|
+
|
|
26
|
+
1. Fork the repo and create a feature branch from `master`
|
|
27
|
+
2. Make your changes
|
|
28
|
+
3. Run the test suite to ensure nothing is broken
|
|
29
|
+
4. Submit a pull request against `master`
|
|
30
|
+
|
|
31
|
+
## Code Style
|
|
32
|
+
|
|
33
|
+
- C99 with `-Wall -Wwrite-strings -pedantic -Werror=incompatible-pointer-types`
|
|
34
|
+
- Internal functions use the `SCS(name)` macro (expands to `_scs_name`)
|
|
35
|
+
- Public API functions use the `scs_` prefix directly
|
|
36
|
+
- Types: `scs_float` (double/float), `scs_int` (int/long long)
|
|
37
|
+
|
|
38
|
+
## Project Layout
|
|
39
|
+
|
|
40
|
+
| Directory | Contents |
|
|
41
|
+
|-----------|----------|
|
|
42
|
+
| `include/` | Public API and internal headers |
|
|
43
|
+
| `src/` | Core solver implementation |
|
|
44
|
+
| `linsys/` | Linear solver backends (pluggable) |
|
|
45
|
+
| `test/` | Test suite (minunit framework) |
|
|
46
|
+
| `docs/src/` | Sphinx documentation source |
|
|
47
|
+
|
|
48
|
+
See `CLAUDE.md` for architecture details and guides on adding new solver
|
|
49
|
+
backends or cone types.
|
data/vendor/scs/Makefile
CHANGED
|
@@ -30,6 +30,7 @@ endif
|
|
|
30
30
|
|
|
31
31
|
SCS_O = src/scs.o
|
|
32
32
|
SCS_INDIR_O = src/scs_indir.o
|
|
33
|
+
SCS_MKL_O = src/scs_mkl.o
|
|
33
34
|
|
|
34
35
|
SRC_FILES = $(wildcard src/*.c)
|
|
35
36
|
INC_FILES = $(wildcard include/*.h)
|
|
@@ -68,6 +69,9 @@ $(SCS_O): src/scs.c $(INC_FILES)
|
|
|
68
69
|
$(SCS_INDIR_O): src/scs.c $(INC_FILES)
|
|
69
70
|
$(CC) $(CFLAGS) -DINDIRECT=1 -c $< -o $@
|
|
70
71
|
|
|
72
|
+
$(SCS_MKL_O): src/scs.c $(INC_FILES)
|
|
73
|
+
$(CC) $(CFLAGS) -DSCS_MKL=1 -c $< -o $@
|
|
74
|
+
|
|
71
75
|
%.o : src/%.c
|
|
72
76
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
73
77
|
|
|
@@ -77,14 +81,16 @@ src/exp_cone.o : src/exp_cone.c $(INC_FILES)
|
|
|
77
81
|
src/aa.o : src/aa.c $(INC_FILES)
|
|
78
82
|
src/rw.o : src/rw.c $(INC_FILES)
|
|
79
83
|
src/linalg.o: src/linalg.c $(INC_FILES)
|
|
80
|
-
src/
|
|
84
|
+
src/ctrlc.o : src/ctrlc.c $(INC_FILES)
|
|
81
85
|
src/scs_version.o: src/scs_version.c $(INC_FILES)
|
|
82
86
|
|
|
83
87
|
$(DIRSRC)/private.o: $(DIRSRC)/private.c $(DIRSRC)/private.h
|
|
84
|
-
$(INDIRSRC)/
|
|
88
|
+
$(INDIRSRC)/private.o: $(INDIRSRC)/private.c $(INDIRSRC)/private.h
|
|
89
|
+
$(DENSESRC)/private.o: $(DENSESRC)/private.c $(DENSESRC)/private.h
|
|
85
90
|
$(MKLSRC)/private.o: $(MKLSRC)/private.c $(MKLSRC)/private.h
|
|
86
91
|
$(CUDSSSRC)/private.o: $(CUDSSSRC)/private.c $(CUDSSSRC)/private.h
|
|
87
92
|
$(CUCC) $(INCLUDE) $(CUDSS_FLAGS) -I$(CUDSSSRC) -c $(CUDSSSRC)/private.c -o $@
|
|
93
|
+
$(ACCELSRC)/private.o: $(ACCELSRC)/private.c $(ACCELSRC)/private.h
|
|
88
94
|
$(LINSYS)/scs_matrix.o: $(LINSYS)/scs_matrix.c $(LINSYS)/scs_matrix.h
|
|
89
95
|
$(LINSYS)/csparse.o: $(LINSYS)/csparse.c $(LINSYS)/csparse.h
|
|
90
96
|
|
|
@@ -98,31 +104,53 @@ $(OUT)/libscsindir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINS
|
|
|
98
104
|
$(ARCHIVE) $@ $^
|
|
99
105
|
- $(RANLIB) $@
|
|
100
106
|
|
|
101
|
-
$(OUT)/
|
|
107
|
+
$(OUT)/libscsdense.a: $(SCS_O) $(SCS_OBJECTS) $(DENSESRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
102
108
|
mkdir -p $(OUT)
|
|
103
109
|
$(ARCHIVE) $@ $^
|
|
104
110
|
- $(RANLIB) $@
|
|
105
111
|
|
|
106
|
-
$(OUT)/
|
|
112
|
+
$(OUT)/libscsmkl.a: $(SCS_MKL_O) $(SCS_OBJECTS) $(MKLSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
107
113
|
mkdir -p $(OUT)
|
|
108
114
|
$(ARCHIVE) $@ $^
|
|
109
115
|
- $(RANLIB) $@
|
|
110
116
|
|
|
111
|
-
$(OUT)/
|
|
117
|
+
$(OUT)/libscscudss.a: $(SCS_O) $(SCS_OBJECTS) $(CUDSSSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
112
118
|
mkdir -p $(OUT)
|
|
113
|
-
$(
|
|
119
|
+
$(ARCHIVE) $@ $^
|
|
120
|
+
- $(RANLIB) $@
|
|
114
121
|
|
|
115
|
-
$(OUT)/
|
|
122
|
+
$(OUT)/libscsaccel.a: $(SCS_O) $(SCS_OBJECTS) $(ACCELSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
116
123
|
mkdir -p $(OUT)
|
|
117
|
-
$(
|
|
124
|
+
$(ARCHIVE) $@ $^
|
|
125
|
+
- $(RANLIB) $@
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
# Link a shared library as its versioned file with the ABI version as its
|
|
128
|
+
# soname/install_name, then point the unversioned name at it (Windows: the
|
|
129
|
+
# DLL itself, unversioned). $(1): extra link flags.
|
|
130
|
+
V = $(call versioned,$@)
|
|
131
|
+
define link_shared
|
|
120
132
|
mkdir -p $(OUT)
|
|
121
|
-
$(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(
|
|
133
|
+
$(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(notdir $(V)) -o $(V) $^ $(LDFLAGS) $(1)
|
|
134
|
+
[ "$(V)" = "$@" ] || ln -sf $(notdir $(V)) $@
|
|
135
|
+
endef
|
|
136
|
+
|
|
137
|
+
$(OUT)/libscsdir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
138
|
+
$(call link_shared,$(BLASLDFLAGS))
|
|
139
|
+
|
|
140
|
+
$(OUT)/libscsindir.$(SHARED): $(SCS_INDIR_O) $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
141
|
+
$(call link_shared,$(BLASLDFLAGS))
|
|
142
|
+
|
|
143
|
+
$(OUT)/libscsdense.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(DENSESRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
144
|
+
$(call link_shared,$(BLASLDFLAGS))
|
|
145
|
+
|
|
146
|
+
$(OUT)/libscsmkl.$(SHARED): $(SCS_MKL_O) $(SCS_OBJECTS) $(MKLSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
147
|
+
$(call link_shared,$(MKLFLAGS))
|
|
122
148
|
|
|
123
149
|
$(OUT)/libscscudss.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(CUDSSSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
124
|
-
|
|
125
|
-
|
|
150
|
+
$(call link_shared,$(CULDFLAGS))
|
|
151
|
+
|
|
152
|
+
$(OUT)/libscsaccel.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(ACCELSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
|
|
153
|
+
$(call link_shared,-framework Accelerate)
|
|
126
154
|
|
|
127
155
|
$(OUT)/demo_socp_direct: test/random_socp_prob.c $(OUT)/libscsdir.a
|
|
128
156
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
|
|
@@ -130,12 +158,18 @@ $(OUT)/demo_socp_direct: test/random_socp_prob.c $(OUT)/libscsdir.a
|
|
|
130
158
|
$(OUT)/demo_socp_indirect: test/random_socp_prob.c $(OUT)/libscsindir.a
|
|
131
159
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
|
|
132
160
|
|
|
161
|
+
$(OUT)/demo_socp_dense: test/random_socp_prob.c $(OUT)/libscsdense.a
|
|
162
|
+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
|
|
163
|
+
|
|
133
164
|
$(OUT)/demo_socp_mkl: test/random_socp_prob.c $(OUT)/libscsmkl.a
|
|
134
165
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MKLFLAGS)
|
|
135
166
|
|
|
136
167
|
$(OUT)/demo_socp_cudss: test/random_socp_prob.c $(OUT)/libscscudss.a
|
|
137
168
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CUDSS_LDFLAGS)
|
|
138
169
|
|
|
170
|
+
$(OUT)/demo_socp_accelerate: test/random_socp_prob.c $(OUT)/libscsaccel.a
|
|
171
|
+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -framework Accelerate
|
|
172
|
+
|
|
139
173
|
$(OUT)/run_from_file_direct: test/run_from_file.c $(OUT)/libscsdir.a
|
|
140
174
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
|
|
141
175
|
|
|
@@ -147,19 +181,35 @@ $(OUT)/run_from_file_gpu_indirect: test/run_from_file.c $(OUT)/libscsgpuindir.a
|
|
|
147
181
|
|
|
148
182
|
# basic testing
|
|
149
183
|
.PHONY: test
|
|
150
|
-
|
|
184
|
+
TEST_TARGETS = $(OUT)/run_tests_indirect $(OUT)/run_tests_direct
|
|
185
|
+
ifneq ($(USE_LAPACK),0)
|
|
186
|
+
TEST_TARGETS += $(OUT)/run_tests_dense
|
|
187
|
+
endif
|
|
188
|
+
ifeq ($(UNAME), Darwin)
|
|
189
|
+
ifeq ($(DLONG), 0)
|
|
190
|
+
TEST_TARGETS += $(OUT)/run_tests_accelerate
|
|
191
|
+
endif
|
|
192
|
+
endif
|
|
193
|
+
test: $(TEST_TARGETS)
|
|
151
194
|
$(OUT)/run_tests_indirect: test/run_tests.c $(OUT)/libscsindir.a
|
|
152
195
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) -Itest
|
|
153
196
|
$(OUT)/run_tests_direct: test/run_tests.c $(OUT)/libscsdir.a
|
|
154
197
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) -Itest
|
|
198
|
+
$(OUT)/test_rw_settings: test/rw_settings.c test/problems/test_rw_settings.h $(OUT)/libscsdir.a
|
|
199
|
+
$(CC) $(CFLAGS) -o $@ $< $(OUT)/libscsdir.a $(LDFLAGS) $(BLASLDFLAGS) -Itest
|
|
200
|
+
$(OUT)/run_tests_dense: test/run_tests.c $(OUT)/libscsdense.a
|
|
201
|
+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) -Itest
|
|
155
202
|
$(OUT)/run_tests_mkl: test/run_tests.c $(OUT)/libscsmkl.a
|
|
156
203
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MKLFLAGS) -Itest
|
|
157
204
|
|
|
158
205
|
$(OUT)/run_tests_cudss: test/run_tests.c $(OUT)/libscscudss.a
|
|
159
206
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CUDSS_LDFLAGS) -Itest
|
|
160
207
|
|
|
208
|
+
$(OUT)/run_tests_accelerate: test/run_tests.c $(OUT)/libscsaccel.a
|
|
209
|
+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -framework Accelerate -Itest
|
|
210
|
+
|
|
161
211
|
.PHONY: test_gpu
|
|
162
|
-
test_gpu: $(OUT)/run_tests_gpu_indirect
|
|
212
|
+
test_gpu: $(OUT)/run_tests_gpu_indirect
|
|
163
213
|
|
|
164
214
|
.PHONY: mkl
|
|
165
215
|
mkl: mklroot $(OUT)/libscsmkl.a $(OUT)/libscsmkl.$(SHARED) $(OUT)/run_tests_mkl $(OUT)/demo_socp_mkl
|
|
@@ -168,57 +218,41 @@ ifndef MKLROOT
|
|
|
168
218
|
$(error MKLROOT is undefined, set MKLROOT to the MKL install location)
|
|
169
219
|
endif
|
|
170
220
|
|
|
171
|
-
.PHONY:
|
|
221
|
+
.PHONY: cudss
|
|
172
222
|
cudss: $(OUT)/libscscudss.a $(OUT)/libscscudss.$(SHARED) $(OUT)/run_tests_cudss $(OUT)/demo_socp_cudss
|
|
173
223
|
|
|
224
|
+
.PHONY: accelerate
|
|
225
|
+
accelerate: $(OUT)/libscsaccel.a $(OUT)/libscsaccel.$(SHARED) $(OUT)/run_tests_accelerate $(OUT)/demo_socp_accelerate
|
|
226
|
+
|
|
174
227
|
$(OUT)/run_tests_gpu_indirect: test/run_tests.c $(OUT)/libscsgpuindir.a
|
|
175
228
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS) -Itest
|
|
176
229
|
|
|
177
|
-
# $(OUT)/run_tests_gpu_direct: test/run_tests.c $(OUT)/libscsgpudir.a
|
|
178
|
-
# $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS) -Itest
|
|
179
|
-
|
|
180
230
|
# REQUIRES GPU AND CUDA INSTALLED
|
|
181
|
-
|
|
231
|
+
# Note: only the GPU indirect solver is currently implemented.
|
|
232
|
+
gpu: gpu_indirect
|
|
182
233
|
|
|
183
|
-
# gpu_direct: $(OUT)/demo_socp_gpu_direct $(OUT)/libscsgpudir.$(SHARED) $(OUT)/libscsgpudir.a $(OUT)/run_from_file_gpu_direct
|
|
184
234
|
gpu_indirect: $(OUT)/demo_socp_gpu_indirect $(OUT)/libscsgpuindir.$(SHARED) $(OUT)/libscsgpuindir.a $(OUT)/run_from_file_gpu_indirect
|
|
185
235
|
|
|
186
236
|
$(LINSYS)/gpu/gpu.o: $(LINSYS)/gpu/gpu.c
|
|
187
237
|
$(CC) -c -o $@ $^ $(CUDAFLAGS)
|
|
188
238
|
|
|
189
|
-
# $(GPUDIR)/private.o: $(GPUDIR)/private.c
|
|
190
|
-
# $(CUCC) -c -o $(GPUDIR)/private.o $^ $(CUDAFLAGS)
|
|
191
|
-
|
|
192
239
|
$(GPUINDIR)/private.o: $(GPUINDIR)/private.c
|
|
193
240
|
$(CC) -c -o $@ $^ $(CUDAFLAGS)
|
|
194
241
|
|
|
195
|
-
# $(OUT)/libscsgpudir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
|
|
196
|
-
# mkdir -p $(OUT)
|
|
197
|
-
# $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS)
|
|
198
|
-
|
|
199
|
-
# $(OUT)/libscsgpudir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
|
|
200
|
-
# mkdir -p $(OUT)
|
|
201
|
-
# $(ARCHIVE) $@ $^
|
|
202
|
-
# - $(RANLIB) $@
|
|
203
|
-
|
|
204
242
|
$(OUT)/libscsgpuindir.$(SHARED): $(SCS_INDIR_O) $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o $(LINSYS)/gpu/gpu.o
|
|
205
|
-
|
|
206
|
-
$(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS)
|
|
243
|
+
$(call link_shared,$(BLASLDFLAGS) $(CULDFLAGS))
|
|
207
244
|
|
|
208
245
|
$(OUT)/libscsgpuindir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o $(LINSYS)/gpu/gpu.o
|
|
209
246
|
mkdir -p $(OUT)
|
|
210
247
|
$(ARCHIVE) $@ $^
|
|
211
248
|
- $(RANLIB) $@
|
|
212
249
|
|
|
213
|
-
# $(OUT)/demo_socp_gpu_direct: test/random_socp_prob.c $(OUT)/libscsgpudir.a
|
|
214
|
-
# $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS)
|
|
215
|
-
|
|
216
250
|
$(OUT)/demo_socp_gpu_indirect: test/random_socp_prob.c $(OUT)/libscsgpuindir.a
|
|
217
251
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS)
|
|
218
252
|
|
|
219
253
|
.PHONY: clean purge
|
|
220
254
|
clean:
|
|
221
|
-
@rm -rf $(TARGETS) $(SCS_O) $(SCS_INDIR_O) $(SCS_OBJECTS) $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/*.o $(DIRSRC)/*.o $(INDIRSRC)/*.o $(MKLSRC)/*.o $(GPUDIR)/*.o $(GPUINDIR)/*.o $(LINSYS)/gpu/*.o
|
|
255
|
+
@rm -rf $(TARGETS) $(SCS_O) $(SCS_INDIR_O) $(SCS_MKL_O) $(SCS_OBJECTS) $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/*.o $(DIRSRC)/*.o $(INDIRSRC)/*.o $(DENSESRC)/*.o $(MKLSRC)/*.o $(ACCELSRC)/*.o $(GPUDIR)/*.o $(GPUINDIR)/*.o $(LINSYS)/gpu/*.o src/spectral_cones/*.o src/spectral_cones/*/*.o
|
|
222
256
|
@rm -rf $(OUT)/*.dSYM
|
|
223
257
|
@rm -rf matlab/*.mex*
|
|
224
258
|
@rm -rf .idea
|
|
@@ -230,19 +264,32 @@ purge: clean
|
|
|
230
264
|
INSTALL_INC_FILES = $(INC_FILES)
|
|
231
265
|
|
|
232
266
|
INSTALL_TARGETS = $(OUT)/libscsdir.a $(OUT)/libscsindir.a $(OUT)/libscsdir.$(SHARED) $(OUT)/libscsindir.$(SHARED)
|
|
233
|
-
INSTALL_GPU_TARGETS = $(OUT)/libscsgpuindir.a $(OUT)/libscsgpuindir.$(SHARED)
|
|
267
|
+
INSTALL_GPU_TARGETS = $(OUT)/libscsgpuindir.a $(OUT)/libscsgpuindir.$(SHARED)
|
|
268
|
+
|
|
269
|
+
# shared libraries are installed under their versioned names with the
|
|
270
|
+
# unversioned symlink alongside
|
|
271
|
+
INSTALL_SHARED = $(filter %.$(SHARED),$(INSTALL_TARGETS))
|
|
272
|
+
INSTALL_GPU_SHARED = $(filter %.$(SHARED),$(INSTALL_GPU_TARGETS))
|
|
273
|
+
# the versioned files, plus the unversioned symlinks copied as symlinks
|
|
274
|
+
install_shared = $(INSTALL) -m 644 $(call versioned,$(1)) $(INSTALL_LIB_DIR) && \
|
|
275
|
+
{ [ "$(call versioned,$(1))" = "$(1)" ] || cp -RP $(1) $(INSTALL_LIB_DIR); }
|
|
234
276
|
|
|
235
277
|
INSTALL_INC_DIR = $(DESTDIR)$(PREFIX)/include/scs/
|
|
236
278
|
INSTALL_LIB_DIR = $(DESTDIR)$(PREFIX)/lib/
|
|
237
279
|
|
|
280
|
+
.PHONY: dense
|
|
281
|
+
dense: $(OUT)/libscsdense.a $(OUT)/libscsdense.$(SHARED) $(OUT)/run_tests_dense $(OUT)/demo_socp_dense
|
|
282
|
+
|
|
238
283
|
.PHONY: install install_gpu direct indirect
|
|
239
284
|
install: $(INSTALL_INC_FILES) $(INSTALL_TARGETS)
|
|
240
285
|
$(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
|
|
241
286
|
$(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
|
|
242
|
-
$(INSTALL) -m 644 $(INSTALL_TARGETS) $(INSTALL_LIB_DIR)
|
|
287
|
+
$(INSTALL) -m 644 $(filter-out %.$(SHARED),$(INSTALL_TARGETS)) $(INSTALL_LIB_DIR)
|
|
288
|
+
$(call install_shared,$(INSTALL_SHARED))
|
|
243
289
|
install_gpu: $(INSTALL_INC_FILES) $(INSTALL_GPU_TARGETS)
|
|
244
290
|
$(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
|
|
245
291
|
$(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
|
|
246
|
-
$(INSTALL) -m 644 $(INSTALL_GPU_TARGETS) $(INSTALL_LIB_DIR)
|
|
247
|
-
|
|
248
|
-
|
|
292
|
+
$(INSTALL) -m 644 $(filter-out %.$(SHARED),$(INSTALL_GPU_TARGETS)) $(INSTALL_LIB_DIR)
|
|
293
|
+
$(call install_shared,$(INSTALL_GPU_SHARED))
|
|
294
|
+
direct: $(OUT)/libscsdir.$(SHARED) $(OUT)/demo_socp_direct $(OUT)/run_from_file_direct $(OUT)/run_tests_direct
|
|
295
|
+
indirect: $(OUT)/libscsindir.$(SHARED) $(OUT)/demo_socp_indirect $(OUT)/run_from_file_indirect $(OUT)/run_tests_indirect
|
data/vendor/scs/README.md
CHANGED
|
@@ -4,11 +4,105 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://github.com/cvxgrp/scs/actions/workflows/build.yml)
|
|
6
6
|
[](https://www.cvxgrp.org/scs/)
|
|
7
|
-
|
|
7
|
+
[](https://pepy.tech/projects/scs)
|
|
8
|
+
[](https://anaconda.org/conda-forge/scs)
|
|
8
9
|
|
|
9
10
|
SCS (`splitting conic solver`) is a numerical optimization package for solving
|
|
10
|
-
large-scale convex cone problems. The current version is `3.
|
|
11
|
+
large-scale convex cone problems. The current version is `3.3.1`.
|
|
11
12
|
|
|
12
13
|
The full documentation is available [here](https://www.cvxgrp.org/scs/).
|
|
13
14
|
|
|
14
15
|
If you wish to cite SCS please cite the papers listed [here](https://www.cvxgrp.org/scs/citing).
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
SCS solves convex cone programs of the form:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
minimize (1/2) x'Px + c'x
|
|
23
|
+
subject to Ax + s = b, s in K
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
where `K` is a product of convex cones. It uses an operator-splitting method
|
|
27
|
+
(ADMM) with Anderson acceleration to achieve fast convergence.
|
|
28
|
+
|
|
29
|
+
**Supported cones:** linear (LP), second-order (SOCP), semidefinite (SDP),
|
|
30
|
+
exponential, power, complex semidefinite, and spectral cones (log-determinant,
|
|
31
|
+
nuclear norm, sum-of-largest eigenvalues).
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- Multiple linear solver backends: sparse direct (QDLDL), dense direct (LAPACK),
|
|
36
|
+
iterative (CG), Intel MKL Pardiso, Apple Accelerate (macOS), NVIDIA cuDSS, GPU
|
|
37
|
+
- Anderson acceleration for faster convergence, including solve diagnostics
|
|
38
|
+
- Problem data normalization/equilibration for numerical stability
|
|
39
|
+
- Warm-starting and incremental `b`/`c` updates via `scs_update`
|
|
40
|
+
- Ctrl-C signal handling for graceful interruption
|
|
41
|
+
- Configurable precision (`float`/`double`) and index type (`int`/`long long`)
|
|
42
|
+
- MIT licensed
|
|
43
|
+
|
|
44
|
+
## Building from Source
|
|
45
|
+
|
|
46
|
+
### Make (default)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
make # Build direct + indirect solvers with BLAS/LAPACK
|
|
50
|
+
make test # Build test binaries
|
|
51
|
+
./out/run_tests_direct # Run direct solver tests
|
|
52
|
+
./out/run_tests_indirect
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### CMake
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mkdir build && cd build
|
|
59
|
+
cmake -DBUILD_TESTING=ON -DUSE_LAPACK=ON ..
|
|
60
|
+
cmake --build .
|
|
61
|
+
ctest
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Common Build Flags
|
|
65
|
+
|
|
66
|
+
| Flag | Default | Description |
|
|
67
|
+
|------|---------|-------------|
|
|
68
|
+
| `USE_LAPACK` | `1` | Enable BLAS/LAPACK (required for SDP support) |
|
|
69
|
+
| `DLONG` | `0` | Use 64-bit integer indexing |
|
|
70
|
+
| `SFLOAT` | `0` | Use single-precision floats |
|
|
71
|
+
| `USE_SPECTRAL_CONES` | `0` | Enable spectral cone support (requires LAPACK) |
|
|
72
|
+
| `USE_OPENMP` | `0` | Enable OpenMP parallelization |
|
|
73
|
+
|
|
74
|
+
Example: `make DLONG=1 USE_LAPACK=1`
|
|
75
|
+
|
|
76
|
+
## Language Interfaces
|
|
77
|
+
|
|
78
|
+
SCS has interfaces for several languages:
|
|
79
|
+
|
|
80
|
+
- **Python:** `pip install scs` ([PyPI](https://pypi.org/project/scs/))
|
|
81
|
+
- **Julia:** [SCS.jl](https://github.com/jump-dev/SCS.jl)
|
|
82
|
+
- **R:** [scs](https://cran.r-project.org/package=scs)
|
|
83
|
+
- **MATLAB:** See the [documentation](https://www.cvxgrp.org/scs/install/matlab.html)
|
|
84
|
+
- **Ruby:** [scs-ruby](https://github.com/ankane/scs-ruby)
|
|
85
|
+
|
|
86
|
+
SCS is the default solver in [CVXPY](https://www.cvxpy.org/).
|
|
87
|
+
|
|
88
|
+
## Project Structure
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
include/ Public API and internal headers
|
|
92
|
+
src/ Core solver implementation
|
|
93
|
+
linsys/ Linear solver backends (pluggable architecture)
|
|
94
|
+
cpu/direct/ Sparse Cholesky (QDLDL, default)
|
|
95
|
+
cpu/indirect/ Conjugate gradient
|
|
96
|
+
cpu/dense/ Dense LU (LAPACK dgetrf, for small problems)
|
|
97
|
+
mkl/direct/ Intel MKL Pardiso
|
|
98
|
+
accelerate/direct/ Apple Accelerate sparse LDLt (macOS)
|
|
99
|
+
cudss/direct/ NVIDIA cuDSS
|
|
100
|
+
gpu/indirect/ GPU iterative solver
|
|
101
|
+
external/ Vendored dependencies (AMD, QDLDL)
|
|
102
|
+
test/ Test suite (minunit framework)
|
|
103
|
+
docs/src/ Sphinx documentation source
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT License. See [LICENSE.txt](LICENSE.txt).
|
data/vendor/scs/include/aa.h
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Anderson acceleration (AA) interface for fixed-point iteration.
|
|
3
|
+
* Stores a sliding window of past iterates and computes an accelerated
|
|
4
|
+
* step that can dramatically speed up convergence of ADMM.
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
#ifndef AA_H_GUARD
|
|
2
8
|
#define AA_H_GUARD
|
|
3
9
|
|
|
@@ -5,36 +11,63 @@
|
|
|
5
11
|
extern "C" {
|
|
6
12
|
#endif
|
|
7
13
|
|
|
14
|
+
#include "aa_stats.h"
|
|
8
15
|
#include "glbopts.h"
|
|
9
|
-
#include <stdio.h>
|
|
10
|
-
#include <stdlib.h>
|
|
11
|
-
#include <string.h>
|
|
12
16
|
|
|
13
17
|
typedef scs_float aa_float;
|
|
14
18
|
typedef scs_int aa_int;
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
/* AaWork is declared in scs.h (included via glbopts.h) */
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* Initialize Anderson Acceleration, allocates memory.
|
|
20
24
|
*
|
|
21
25
|
* @param dim the dimension of the variable for AA
|
|
22
26
|
* @param mem the memory (number of past iterations used) for AA
|
|
27
|
+
* @param min_len minimum number of past iterates required before AA
|
|
28
|
+
* begins producing updates. Must be >= 1 when
|
|
29
|
+
* mem > 0; if min_len exceeds the effective
|
|
30
|
+
* memory (min(mem, dim)) it is clamped down,
|
|
31
|
+
* mirroring how `mem` is clamped to `dim` for
|
|
32
|
+
* rank stability. Set min_len == mem to delay
|
|
33
|
+
* AA until the memory is full (stable default
|
|
34
|
+
* for large `mem`); set min_len == 1 to start
|
|
35
|
+
* extrapolating from the very first residual
|
|
36
|
+
* pair (useful when `mem` is large but you
|
|
37
|
+
* still want early acceleration). Ignored when
|
|
38
|
+
* mem == 0.
|
|
23
39
|
* @param type1 if True use type 1 AA, otherwise use type 2
|
|
24
|
-
* @param regularization
|
|
25
|
-
*
|
|
26
|
-
*
|
|
40
|
+
* @param regularization Tikhonov regularization for the AA least-squares
|
|
41
|
+
* system. Three modes, selected by sign:
|
|
42
|
+
* > 0 : problem-scaled, r = regularization *
|
|
43
|
+
* ||A||_F ||Y||_F. Type-I: 1e-8 works well;
|
|
44
|
+
* Type-II: more stable, 1e-12 often fine.
|
|
45
|
+
* < 0 : pinned absolute, r = -regularization
|
|
46
|
+
* (no Frobenius scaling — useful when the
|
|
47
|
+
* problem scale is known).
|
|
48
|
+
* = 0 : no regularization.
|
|
49
|
+
* Only non-finite values (NaN/Inf) are rejected.
|
|
50
|
+
* @param relaxation float \in [0,2], mixing parameter (1.0 is vanilla)
|
|
27
51
|
* @param safeguard_factor factor that controls safeguarding checks
|
|
28
52
|
* larger is more aggressive but less stable
|
|
29
53
|
* @param max_weight_norm float, maximum norm of AA weights
|
|
54
|
+
* @param ir_max_steps max iterative refinement passes on the γ solve.
|
|
55
|
+
* 0 disables IR. Each step is O(mem²) and loops
|
|
56
|
+
* until the correction stops contracting, so on
|
|
57
|
+
* well-conditioned problems only one step runs
|
|
58
|
+
* regardless of this cap. Raise it (e.g. 5) for
|
|
59
|
+
* ill-conditioned systems where more digits can
|
|
60
|
+
* be recovered; lower it for tighter cost bounds.
|
|
30
61
|
* @param verbosity if greater than 0 prints out various info
|
|
31
62
|
*
|
|
32
63
|
* @return pointer to AA workspace
|
|
33
64
|
*
|
|
34
65
|
*/
|
|
35
|
-
AaWork *aa_init(aa_int dim, aa_int mem, aa_int
|
|
36
|
-
aa_float
|
|
37
|
-
aa_float
|
|
66
|
+
AaWork *aa_init(aa_int dim, aa_int mem, aa_int min_len, aa_int type1,
|
|
67
|
+
aa_float regularization, aa_float relaxation,
|
|
68
|
+
aa_float safeguard_factor, aa_float max_weight_norm,
|
|
69
|
+
aa_int ir_max_steps, aa_int verbosity);
|
|
70
|
+
|
|
38
71
|
/**
|
|
39
72
|
* Apply Anderson Acceleration. The usage pattern should be as follows:
|
|
40
73
|
*
|
|
@@ -42,7 +75,7 @@ AaWork *aa_init(aa_int dim, aa_int mem, aa_int type1, aa_float regularization,
|
|
|
42
75
|
* - if (i > 0): aa_apply(x, x_prev, a)
|
|
43
76
|
* - x_prev = x.copy()
|
|
44
77
|
* - x = F(x)
|
|
45
|
-
* - aa_safeguard(x, x_prev, a)
|
|
78
|
+
* - aa_safeguard(x, x_prev, a) (optional but helps stability)
|
|
46
79
|
*
|
|
47
80
|
* Here F is the map we are trying to find the fixed point for. We put the AA
|
|
48
81
|
* before the map so that any properties of the map are maintained at the end.
|
|
@@ -88,12 +121,27 @@ void aa_finish(AaWork *a);
|
|
|
88
121
|
* Reset Anderson Acceleration.
|
|
89
122
|
*
|
|
90
123
|
* Resets AA as if at the first iteration, reuses original memory allocations.
|
|
124
|
+
* Does not clear lifetime diagnostic counters; use aa_get_stats after reset
|
|
125
|
+
* to read them, or just re-init the workspace for a clean slate.
|
|
91
126
|
*
|
|
92
127
|
* @param a AA workspace from aa_init
|
|
93
128
|
*
|
|
94
129
|
*/
|
|
95
130
|
void aa_reset(AaWork *a);
|
|
96
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Return lifetime diagnostic counters.
|
|
134
|
+
*
|
|
135
|
+
* Use for post-hoc diagnosis of why AA is or isn't accelerating a
|
|
136
|
+
* given fixed-point iteration — e.g. `n_reject_weight_cap` rising
|
|
137
|
+
* suggests loosening `max_weight_norm` or raising `regularization`;
|
|
138
|
+
* `n_safeguard_reject` rising suggests tuning `safeguard_factor` or
|
|
139
|
+
* `mem`. Do not call with `a == NULL`.
|
|
140
|
+
*
|
|
141
|
+
* @param a AA workspace from aa_init (must be non-NULL).
|
|
142
|
+
*/
|
|
143
|
+
AaStats aa_get_stats(const AaWork *a);
|
|
144
|
+
|
|
97
145
|
#ifdef __cplusplus
|
|
98
146
|
}
|
|
99
147
|
#endif
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public Anderson acceleration diagnostic counters.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#ifndef AA_STATS_H_GUARD
|
|
6
|
+
#define AA_STATS_H_GUARD
|
|
7
|
+
|
|
8
|
+
#ifdef __cplusplus
|
|
9
|
+
extern "C" {
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "scs_types.h"
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Lifetime diagnostics for an Anderson acceleration workspace.
|
|
16
|
+
*
|
|
17
|
+
* Counters accumulate from aa_init and are not cleared by aa_reset, including
|
|
18
|
+
* internal resets after safeguard rejections. Rejection causes are split so a
|
|
19
|
+
* caller can tell what needs tuning.
|
|
20
|
+
*/
|
|
21
|
+
typedef struct {
|
|
22
|
+
/** Internal AA iteration counter. */
|
|
23
|
+
scs_int iter;
|
|
24
|
+
/** Number of AA updates accepted by aa_apply before safeguarding. */
|
|
25
|
+
scs_int n_accept;
|
|
26
|
+
/** Number of AA rejections due to LAPACK errors. */
|
|
27
|
+
scs_int n_reject_lapack;
|
|
28
|
+
/** Number of AA rejections due to rank-zero reduced systems. */
|
|
29
|
+
scs_int n_reject_rank0;
|
|
30
|
+
/** Number of AA rejections due to non-finite weights. */
|
|
31
|
+
scs_int n_reject_nonfinite;
|
|
32
|
+
/** Number of AA rejections due to the weight-norm cap. */
|
|
33
|
+
scs_int n_reject_weight_cap;
|
|
34
|
+
/** Number of AA steps rejected by safeguarding. */
|
|
35
|
+
scs_int n_safeguard_reject;
|
|
36
|
+
/** Rank of the most recent AA solve. */
|
|
37
|
+
scs_int last_rank;
|
|
38
|
+
/** Weight norm from the most recent AA solve. NaN if no solve was attempted. */
|
|
39
|
+
scs_float last_aa_norm;
|
|
40
|
+
/** Regularization used in the most recent AA solve. */
|
|
41
|
+
scs_float last_regularization;
|
|
42
|
+
} AaStats;
|
|
43
|
+
|
|
44
|
+
#ifdef __cplusplus
|
|
45
|
+
}
|
|
46
|
+
#endif
|
|
47
|
+
#endif
|
data/vendor/scs/include/cones.h
CHANGED
|
@@ -6,15 +6,13 @@ extern "C" {
|
|
|
6
6
|
#endif
|
|
7
7
|
|
|
8
8
|
#include "glbopts.h"
|
|
9
|
-
#include "scs.h"
|
|
10
9
|
#include "scs_blas.h"
|
|
11
10
|
#include "scs_work.h"
|
|
12
|
-
#include <string.h>
|
|
13
11
|
|
|
14
12
|
#ifdef USE_SPECTRAL_CONES
|
|
15
|
-
#include "util_spectral_cones.h"
|
|
13
|
+
#include "util_spectral_cones.h" /* for Newton_stats */
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
/* macro for time measurements of SpectralSCS */
|
|
18
16
|
#ifdef SPECTRAL_TIMING_FLAG
|
|
19
17
|
#define SPECTRAL_TIMING(action) action
|
|
20
18
|
#else
|
|
@@ -32,11 +30,21 @@ struct SCS_CONE_WORK {
|
|
|
32
30
|
ScsCone *k; /* original cone information */
|
|
33
31
|
scs_int *cone_boundaries;
|
|
34
32
|
scs_int cone_boundaries_len;
|
|
33
|
+
/* Per boundary entry: matrix dimension n if the block is a real PSD
|
|
34
|
+
* cone (svec length n(n+1)/2), else 0. PSD blocks admit a richer
|
|
35
|
+
* cone-invariant metric than a single scalar: any svec-diagonal
|
|
36
|
+
* weight of the rank-one form w_ij = delta_i * delta_j (a diagonal
|
|
37
|
+
* congruence X -> DXD). enforce_cone_boundaries fits this form for
|
|
38
|
+
* PSD blocks instead of collapsing them to one value. */
|
|
39
|
+
scs_int *cone_boundaries_psd_n;
|
|
40
|
+
/* scratch for PSD diagonal-congruence factors, length max PSD dim */
|
|
41
|
+
scs_float *psd_gamma;
|
|
35
42
|
scs_int scaled_cones; /* boolean, whether the cones have been scaled */
|
|
36
43
|
scs_float *s; /* used for Moreau decomposition in projection */
|
|
37
44
|
scs_int m; /* total length of cone */
|
|
38
45
|
/* box cone quantities */
|
|
39
46
|
scs_float box_t_warm_start;
|
|
47
|
+
scs_float *r_box_inv; /* precomputed 1/r_box[j] for box cone Newton */
|
|
40
48
|
|
|
41
49
|
#ifdef USE_LAPACK
|
|
42
50
|
/* workspace for eigenvector decompositions: */
|
|
@@ -54,7 +62,7 @@ struct SCS_CONE_WORK {
|
|
|
54
62
|
Value_index *work_ell1;
|
|
55
63
|
scs_float *work_ell1_proj;
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
/* used for timing spectral vector cone and spectral matrix cone projections */
|
|
58
66
|
SPECTRAL_TIMING(scs_float tot_time_mat_cone_proj;)
|
|
59
67
|
SPECTRAL_TIMING(scs_float tot_time_vec_cone_proj;)
|
|
60
68
|
|
|
@@ -79,7 +87,7 @@ struct SCS_CONE_WORK {
|
|
|
79
87
|
};
|
|
80
88
|
|
|
81
89
|
void SCS(free_cone)(ScsCone *k);
|
|
82
|
-
|
|
90
|
+
scs_int SCS(deep_copy_cone)(ScsCone *dest, const ScsCone *src);
|
|
83
91
|
ScsConeWork *SCS(init_cone)(ScsCone *k, scs_int m);
|
|
84
92
|
char *SCS(get_cone_header)(const ScsCone *k);
|
|
85
93
|
scs_int SCS(validate_cones)(const ScsData *d, const ScsCone *k);
|
|
@@ -88,7 +96,8 @@ scs_int SCS(proj_dual_cone)(scs_float *x, ScsConeWork *c,
|
|
|
88
96
|
void SCS(finish_cone)(ScsConeWork *c);
|
|
89
97
|
void SCS(set_r_y)(const ScsConeWork *c, scs_float scale, scs_float *r_y);
|
|
90
98
|
void SCS(enforce_cone_boundaries)(const ScsConeWork *c, scs_float *vec,
|
|
91
|
-
scs_float (*f)(const scs_float *, scs_int)
|
|
99
|
+
scs_float (*f)(const scs_float *, scs_int),
|
|
100
|
+
scs_int psd_rank1);
|
|
92
101
|
|
|
93
102
|
#ifdef __cplusplus
|
|
94
103
|
}
|