scs 0.6.0 → 0.6.1
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 +4 -0
- data/ext/scs/extconf.rb +3 -9
- data/lib/scs/version.rb +1 -1
- data/vendor/scs/CITATION.cff +2 -2
- data/vendor/scs/CMakeLists.txt +138 -10
- data/vendor/scs/CONTRIBUTING.md +21 -2
- data/vendor/scs/Makefile +4 -3
- data/vendor/scs/README.md +25 -14
- data/vendor/scs/include/cones.h +27 -9
- data/vendor/scs/include/glbopts.h +25 -5
- data/vendor/scs/include/scs.h +10 -8
- data/vendor/scs/include/scs_work.h +2 -1
- data/vendor/scs/linsys/cudss/direct/private.c +50 -2
- data/vendor/scs/linsys/gpu/indirect/private.c +17 -4
- data/vendor/scs/linsys/mkl/direct/private.c +1 -1
- data/vendor/scs/scs.mk +43 -2
- data/vendor/scs/src/aa.c +27 -7
- data/vendor/scs/src/cones.c +851 -163
- data/vendor/scs/src/linalg.c +16 -3
- data/vendor/scs/src/scs.c +91 -46
- data/vendor/scs/src/spectral_cones/logdeterminant/logdet_cone.c +15 -14
- data/vendor/scs/src/spectral_cones/nuclear/ell1_cone.c +1 -4
- data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_eval_cone.c +11 -9
- data/vendor/scs/test/minunit.h +27 -3
- data/vendor/scs/test/mkl_psd_guard.c +282 -0
- data/vendor/scs/test/problem_utils.h +123 -22
- data/vendor/scs/test/problems/complex_PSD.h +2 -1
- data/vendor/scs/test/problems/degenerate.h +10 -3
- data/vendor/scs/test/problems/dense_qp.h +2 -1
- data/vendor/scs/test/problems/hs21_tiny_qp.h +7 -3
- data/vendor/scs/test/problems/hs21_tiny_qp_rw.h +5 -2
- data/vendor/scs/test/problems/issue_140 +0 -0
- data/vendor/scs/test/problems/issue_140.h +19 -0
- data/vendor/scs/test/problems/issue_220 +0 -0
- data/vendor/scs/test/problems/issue_220.h +37 -0
- data/vendor/scs/test/problems/issue_499.h +79 -0
- data/vendor/scs/test/problems/lp_update.h +5 -5
- data/vendor/scs/test/problems/qafiro_tiny_qp.h +25 -5
- data/vendor/scs/test/problems/rob_gauss_cov_est.h +24 -4
- data/vendor/scs/test/problems/sd_and_complex_sd.h +2 -1
- data/vendor/scs/test/problems/small_lp.h +2 -1
- data/vendor/scs/test/problems/small_qp.h +7 -0
- data/vendor/scs/test/problems/test_box_cone.h +2 -1
- data/vendor/scs/test/problems/test_dual_exp_cone.h +2 -1
- data/vendor/scs/test/problems/test_mixed_cones.h +2 -1
- data/vendor/scs/test/problems/test_non_psd_p.h +76 -0
- data/vendor/scs/test/problems/test_normalize_roundtrip.h +14 -12
- data/vendor/scs/test/problems/test_power_cone.h +139 -5
- data/vendor/scs/test/problems/test_prob_from_data_file.h +14 -4
- data/vendor/scs/test/problems/test_psd_metric.h +11 -7
- data/vendor/scs/test/problems/test_psd_n1.h +2 -1
- data/vendor/scs/test/problems/test_psd_parallel.h +383 -0
- data/vendor/scs/test/problems/test_psd_scale_updates.h +186 -0
- data/vendor/scs/test/problems/test_soc_sizes.h +10 -5
- data/vendor/scs/test/problems/test_solver_options.h +10 -3
- data/vendor/scs/test/problems/test_zero_cone.h +2 -1
- data/vendor/scs/test/run_from_file.c +8 -0
- data/vendor/scs/test/run_tests.c +84 -19
- data/vendor/scs/test/spectral_cones_problems/exp_design.h +1 -0
- data/vendor/scs/test/spectral_cones_problems/several_logdet_cones.h +1 -0
- data/vendor/scs/test/spectral_cones_problems/test_spectral_metric_updates.h +163 -0
- metadata +12 -3
- data/vendor/scs/CLAUDE.md +0 -115
data/vendor/scs/CLAUDE.md
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## What This Is
|
|
6
|
-
|
|
7
|
-
SCS (Splitting Conic Solver) is a C library for solving large-scale convex cone optimization problems (LP, SOCP, SDP, ECP, PCP, complex SDP, spectral cones) using the ADMM splitting algorithm with optional Anderson acceleration.
|
|
8
|
-
|
|
9
|
-
## Build Commands
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
make # Build with BLAS/LAPACK (default)
|
|
13
|
-
make USE_LAPACK=0 # Build without LAPACK (no SDP support)
|
|
14
|
-
make DLONG=1 # Build with 64-bit integer indexing
|
|
15
|
-
make USE_SPECTRAL_CONES=1 # Build with spectral cone support (requires LAPACK)
|
|
16
|
-
make USE_OPENMP=1 # Build with OpenMP parallelization
|
|
17
|
-
make purge # Clean all build artifacts
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
CMake alternative:
|
|
21
|
-
```bash
|
|
22
|
-
mkdir build && cd build
|
|
23
|
-
cmake -DBUILD_TESTING=ON -DUSE_LAPACK=ON ..
|
|
24
|
-
cmake --build .
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Outputs go to `out/`: static libs (`libscsdir.a`, `libscsindir.a`), shared libs, and demo/test binaries.
|
|
28
|
-
|
|
29
|
-
## Testing
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
make test # Build test binaries
|
|
33
|
-
./out/run_tests_direct # Run direct solver tests
|
|
34
|
-
./out/run_tests_indirect # Run indirect solver tests
|
|
35
|
-
|
|
36
|
-
# With options:
|
|
37
|
-
make test DLONG=1 USE_LAPACK=1
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Tests use the `minunit.h` framework in `test/`. Individual test problems are in `test/problems/` and `test/spectral_cones_problems/`.
|
|
41
|
-
|
|
42
|
-
## Architecture
|
|
43
|
-
|
|
44
|
-
### Algorithm
|
|
45
|
-
SCS uses ADMM to split convex cone problems into two alternating steps:
|
|
46
|
-
1. **Linear system solve** — factorizes/solves a KKT-like system
|
|
47
|
-
2. **Cone projection** — projects onto the constraint cone
|
|
48
|
-
|
|
49
|
-
Anderson acceleration (`src/aa.c`) speeds convergence. Problem normalization/equilibration (`src/normalize.c`) improves conditioning before solving.
|
|
50
|
-
|
|
51
|
-
### Key Interfaces
|
|
52
|
-
- **`include/linsys.h`** — abstract interface that all linear system solvers must implement; `ScsLinSysWork` is the opaque solver-specific workspace
|
|
53
|
-
- **`include/cones.h`** — cone projection interface; `ScsConeWork` holds precomputed cone data
|
|
54
|
-
- **`include/scs.h`** — public API: `ScsMatrix`, `ScsData`, `ScsCone`, `ScsSettings`, `ScsSolution`
|
|
55
|
-
|
|
56
|
-
### Linear Solver Backends (in `linsys/`)
|
|
57
|
-
- `cpu/direct/` — QDLDL sparse Cholesky (default, bundled in `linsys/external/qdldl/`)
|
|
58
|
-
- `cpu/indirect/` — iterative (conjugate gradient / LSQR)
|
|
59
|
-
- `mkl/direct/` — Intel MKL Pardiso (enabled via `MKLROOT`)
|
|
60
|
-
- `accelerate/direct/` — Apple Accelerate sparse LDLt (macOS only, `make accelerate`)
|
|
61
|
-
- `cudss/direct/` — NVIDIA cuDSS GPU solver
|
|
62
|
-
- `gpu/indirect/` — GPU iterative solver
|
|
63
|
-
|
|
64
|
-
The Makefile selects which backend to compile based on flags. Only one direct or indirect backend is linked per build.
|
|
65
|
-
|
|
66
|
-
### Cone Types
|
|
67
|
-
Supported cones are registered in `src/cones.c`. The `ScsCone` struct fields map to: `z` (zero), `l` (non-negative), `q` (second-order), `s` (PSD), `cs` (complex PSD), `p` (power), `ep`/`ed` (exponential primal/dual). Spectral cones (`USE_SPECTRAL_CONES=1`) add log-determinant, nuclear norm, and sum-of-largest-eigenvalues support via `src/spectral_cones/`.
|
|
68
|
-
|
|
69
|
-
### Compiler Flags
|
|
70
|
-
Defined in `scs.mk`: `-Wall -Wwrite-strings -pedantic -funroll-loops -Werror=incompatible-pointer-types`. Type aliases `scs_float` and `scs_int` in `include/scs_types.h` change with `SFLOAT` and `DLONG` flags.
|
|
71
|
-
|
|
72
|
-
## Key Data Flow
|
|
73
|
-
|
|
74
|
-
The main solve lifecycle is:
|
|
75
|
-
1. **`scs_init`** — validates data, deep-copies and normalizes `A`/`P`/`b`/`c`, sets up linear system solver (factorization for direct), sets up cone workspace
|
|
76
|
-
2. **`scs_solve`** — ADMM loop:
|
|
77
|
-
- Solve linear system (KKT) to get search direction (`project_lin_sys`)
|
|
78
|
-
- Project onto dual cone via Moreau decomposition (`project_cones`)
|
|
79
|
-
- Apply Anderson acceleration every `acceleration_interval` iterations
|
|
80
|
-
- Check convergence / infeasibility / time limit
|
|
81
|
-
- Optionally update scale parameter (adaptive scaling)
|
|
82
|
-
3. **`scs_finish`** — frees all workspace memory
|
|
83
|
-
|
|
84
|
-
`scs_update` allows changing `b`/`c` between solves without re-factorizing.
|
|
85
|
-
|
|
86
|
-
## Adding a New Linear Solver Backend
|
|
87
|
-
|
|
88
|
-
1. Create a new directory under `linsys/`, e.g. `linsys/mybackend/direct/`
|
|
89
|
-
2. Implement the 5 functions declared in `include/linsys.h`:
|
|
90
|
-
- `scs_init_lin_sys_work()` — allocate workspace, factorize if direct
|
|
91
|
-
- `scs_solve_lin_sys()` — solve the KKT system
|
|
92
|
-
- `scs_update_lin_sys_diag_r()` — handle R diagonal updates
|
|
93
|
-
- `scs_free_lin_sys_work()` — deallocate workspace
|
|
94
|
-
- `scs_get_lin_sys_method()` — return a descriptive string
|
|
95
|
-
3. Create `private.h` defining `struct SCS_LIN_SYS_WORK` with your backend's fields
|
|
96
|
-
4. Add Makefile rules following the pattern of the existing backends (see `mkl`, `cudss`)
|
|
97
|
-
5. Add CMake rules following the same pattern in `CMakeLists.txt`
|
|
98
|
-
6. Add a CI workflow in `.github/workflows/`
|
|
99
|
-
|
|
100
|
-
See `linsys/cpu/direct/` for the reference implementation.
|
|
101
|
-
|
|
102
|
-
## Adding a New Cone Type
|
|
103
|
-
|
|
104
|
-
1. Add the new field(s) to `ScsCone` in `include/scs.h`
|
|
105
|
-
2. In `src/cones.c`:
|
|
106
|
-
- Update `SCS(validate_cones)` to validate the new cone's parameters
|
|
107
|
-
- Update `SCS(init_cone)` to compute cone boundaries and allocate workspace
|
|
108
|
-
- Update `SCS(proj_dual_cone)` to project onto the new cone
|
|
109
|
-
- Update `SCS(get_cone_header)` for printing
|
|
110
|
-
- Update `SCS(set_r_y)` for the R diagonal entries
|
|
111
|
-
3. If the projection is complex, put it in a separate source file (like `src/exp_cone.c`)
|
|
112
|
-
4. Update the Makefile object lists and CMakeLists.txt source lists
|
|
113
|
-
5. Add a test in `test/problems/`
|
|
114
|
-
|
|
115
|
-
Cone ordering in the rows of `A` must match the order in `proj_dual_cone`.
|