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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/ext/scs/extconf.rb +3 -9
  4. data/lib/scs/version.rb +1 -1
  5. data/vendor/scs/CITATION.cff +2 -2
  6. data/vendor/scs/CMakeLists.txt +138 -10
  7. data/vendor/scs/CONTRIBUTING.md +21 -2
  8. data/vendor/scs/Makefile +4 -3
  9. data/vendor/scs/README.md +25 -14
  10. data/vendor/scs/include/cones.h +27 -9
  11. data/vendor/scs/include/glbopts.h +25 -5
  12. data/vendor/scs/include/scs.h +10 -8
  13. data/vendor/scs/include/scs_work.h +2 -1
  14. data/vendor/scs/linsys/cudss/direct/private.c +50 -2
  15. data/vendor/scs/linsys/gpu/indirect/private.c +17 -4
  16. data/vendor/scs/linsys/mkl/direct/private.c +1 -1
  17. data/vendor/scs/scs.mk +43 -2
  18. data/vendor/scs/src/aa.c +27 -7
  19. data/vendor/scs/src/cones.c +851 -163
  20. data/vendor/scs/src/linalg.c +16 -3
  21. data/vendor/scs/src/scs.c +91 -46
  22. data/vendor/scs/src/spectral_cones/logdeterminant/logdet_cone.c +15 -14
  23. data/vendor/scs/src/spectral_cones/nuclear/ell1_cone.c +1 -4
  24. data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_eval_cone.c +11 -9
  25. data/vendor/scs/test/minunit.h +27 -3
  26. data/vendor/scs/test/mkl_psd_guard.c +282 -0
  27. data/vendor/scs/test/problem_utils.h +123 -22
  28. data/vendor/scs/test/problems/complex_PSD.h +2 -1
  29. data/vendor/scs/test/problems/degenerate.h +10 -3
  30. data/vendor/scs/test/problems/dense_qp.h +2 -1
  31. data/vendor/scs/test/problems/hs21_tiny_qp.h +7 -3
  32. data/vendor/scs/test/problems/hs21_tiny_qp_rw.h +5 -2
  33. data/vendor/scs/test/problems/issue_140 +0 -0
  34. data/vendor/scs/test/problems/issue_140.h +19 -0
  35. data/vendor/scs/test/problems/issue_220 +0 -0
  36. data/vendor/scs/test/problems/issue_220.h +37 -0
  37. data/vendor/scs/test/problems/issue_499.h +79 -0
  38. data/vendor/scs/test/problems/lp_update.h +5 -5
  39. data/vendor/scs/test/problems/qafiro_tiny_qp.h +25 -5
  40. data/vendor/scs/test/problems/rob_gauss_cov_est.h +24 -4
  41. data/vendor/scs/test/problems/sd_and_complex_sd.h +2 -1
  42. data/vendor/scs/test/problems/small_lp.h +2 -1
  43. data/vendor/scs/test/problems/small_qp.h +7 -0
  44. data/vendor/scs/test/problems/test_box_cone.h +2 -1
  45. data/vendor/scs/test/problems/test_dual_exp_cone.h +2 -1
  46. data/vendor/scs/test/problems/test_mixed_cones.h +2 -1
  47. data/vendor/scs/test/problems/test_non_psd_p.h +76 -0
  48. data/vendor/scs/test/problems/test_normalize_roundtrip.h +14 -12
  49. data/vendor/scs/test/problems/test_power_cone.h +139 -5
  50. data/vendor/scs/test/problems/test_prob_from_data_file.h +14 -4
  51. data/vendor/scs/test/problems/test_psd_metric.h +11 -7
  52. data/vendor/scs/test/problems/test_psd_n1.h +2 -1
  53. data/vendor/scs/test/problems/test_psd_parallel.h +383 -0
  54. data/vendor/scs/test/problems/test_psd_scale_updates.h +186 -0
  55. data/vendor/scs/test/problems/test_soc_sizes.h +10 -5
  56. data/vendor/scs/test/problems/test_solver_options.h +10 -3
  57. data/vendor/scs/test/problems/test_zero_cone.h +2 -1
  58. data/vendor/scs/test/run_from_file.c +8 -0
  59. data/vendor/scs/test/run_tests.c +84 -19
  60. data/vendor/scs/test/spectral_cones_problems/exp_design.h +1 -0
  61. data/vendor/scs/test/spectral_cones_problems/several_logdet_cones.h +1 -0
  62. data/vendor/scs/test/spectral_cones_problems/test_spectral_metric_updates.h +163 -0
  63. metadata +12 -3
  64. data/vendor/scs/CLAUDE.md +0 -115
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec3e1c1e0a72a5f66811dee0e533de60349c2f2c7fdda5a97041e729a3a50e6c
4
- data.tar.gz: a71c167273d92064b8b24828bc78c6f62fda6a3b3b5c8b04fd5beeba0262a2d9
3
+ metadata.gz: 74ad4b0fd2bbf7d34bb0c8ba742eecc986712af62d23ffb31fe296d5b2f0a353
4
+ data.tar.gz: 70ef21e8420c7c540580259d9099b845c4cfa8105046bc7d1570112cf8af8d61
5
5
  SHA512:
6
- metadata.gz: 77fdb9295bf706e2730ac438d4ed570a012430878e26c72e0832da0453734ed1bf5aba09f9c1238094f914bc6dcc6551c5ef73197371b92d0dd4d2cf37e9f204
7
- data.tar.gz: 76b6070b6898235cf070ab65598eb619e9a323f037df4dba4f4504232fd03c86d44a7783de1e0c5d760f69ae38093b1a1ce31212194c60b5d60f33d29b6afab9
6
+ metadata.gz: 40f0f577553b38fbfa7f3bdc4472bc9c89945dee0714227def166adbe1d40d617070e3c3b37312c88fb9e9d7597cb2d23b0fcd4015ad7754b29533409ab46817
7
+ data.tar.gz: dd2074e5388fbbf559bac714f348ed43aedd218d0a3ae013c4ccb91bc0b1dd95b3160f0817ea075b5533f63e4a74c7ce035c0306773e8381b48b98b299c0187a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.6.1 (2026-11-15)
2
+
3
+ - Updated SCS to 3.3.2
4
+
1
5
  ## 0.6.0 (2026-09-05)
2
6
 
3
7
  - Updated SCS to 3.3.1
data/ext/scs/extconf.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  require "mkmf"
2
2
 
3
- def run(command)
4
- puts ">> #{command}"
5
- unless system(command)
6
- raise "Command failed"
7
- end
8
- end
9
-
10
3
  def inreplace(file, pattern, replacement)
11
4
  contents = File.read(file)
12
5
  File.write(file, contents.gsub(pattern, replacement))
@@ -20,9 +13,10 @@ Dir.chdir(scs) do
20
13
  case arch
21
14
  when /mingw/
22
15
  inreplace("scs.mk", "USE_LAPACK = 1", "USE_LAPACK = 0")
23
- run "ridk exec make"
16
+ system "ridk", "exec", "make", exception: true
24
17
  else
25
- run "make"
18
+ # remove -march=native for portability
19
+ system "make", "OPT=-O3 -fno-math-errno", exception: true
26
20
  end
27
21
  end
28
22
 
data/lib/scs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SCS
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -10,8 +10,8 @@ authors:
10
10
  - family-names: "Boyd"
11
11
  given-names: "Stephen"
12
12
  title: "SCS: Splitting Conic Solver"
13
- version: 3.3.1
14
- date-released: '2026-09-05'
13
+ version: 3.3.2
14
+ date-released: '2026-11-15'
15
15
  url: "https://github.com/cvxgrp/scs"
16
16
 
17
17
  # Original SCS paper:
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.22)
8
8
  project(
9
9
  scs
10
10
  LANGUAGES C
11
- VERSION 3.3.1)
11
+ VERSION 3.3.2)
12
12
 
13
13
  # ABI version, the loader identity of the shared libraries (libscsdir.so.3.3):
14
14
  # bump on ABI breaks, never on patch releases. scs.mk derives the same value
@@ -113,12 +113,37 @@ if(USE_SPECTRAL_CONES AND NOT USE_LAPACK)
113
113
  message(FATAL_ERROR "USE_SPECTRAL_CONES requires USE_LAPACK to be ON")
114
114
  endif()
115
115
 
116
+ # Whether OpenMP and the parallel PSD projection are in the build is reported
117
+ # further down, once CMake has looked for OpenMP.
116
118
  option(USE_OPENMP "Compile with OpenMP support" OFF)
117
- message(STATUS "OpenMP parallelization is ${USE_OPENMP}")
119
+
120
+ # Projects the PSD blocks of a problem in parallel, on up to OMP_NUM_THREADS
121
+ # threads that each call LAPACK for their own blocks. Off by default, because
122
+ # it is only faster when the BLAS runs on one thread inside the threads of SCS:
123
+ # a BLAS on the same OpenMP runtime as SCS does that by itself, and any other
124
+ # multithreaded BLAS has to be set to one thread, or the threads of the two
125
+ # multiply. See "Parallel projection of PSD blocks" on the BLAS and LAPACK page
126
+ # of the documentation, and the comment on the option in src/cones.c.
127
+ option(USE_PARALLEL_PSD
128
+ "Project PSD blocks in parallel (requires USE_OPENMP and USE_LAPACK)" OFF)
129
+ if(USE_PARALLEL_PSD AND NOT (USE_OPENMP AND USE_LAPACK))
130
+ message(FATAL_ERROR
131
+ "USE_PARALLEL_PSD requires USE_OPENMP and USE_LAPACK to be ON")
132
+ endif()
118
133
 
119
134
  option(USE_CUDSS "Compile with cuDSS support" OFF)
120
135
  message(STATUS "cuDSS support is ${USE_CUDSS}")
121
136
 
137
+ # SCS's own GPU linear system solver is the indirect (conjugate gradient)
138
+ # one; the cuDSS direct solver has its own option above.
139
+ option(USE_GPU "Compile the CUDA GPU indirect solver" OFF)
140
+ message(STATUS "GPU (CUDA) support is ${USE_GPU}")
141
+
142
+ if(USE_GPU)
143
+ option(GPU_TRANSPOSE_MAT "Store the transpose of A in GPU memory" ON)
144
+ message(STATUS "Transposing A in GPU memory is ${GPU_TRANSPOSE_MAT}")
145
+ endif()
146
+
122
147
  if(APPLE)
123
148
  option(USE_APPLE_ACCELERATE "Use Apple Accelerate framework for sparse LDLt" OFF)
124
149
  message(STATUS "Apple Accelerate support is ${USE_APPLE_ACCELERATE}")
@@ -189,14 +214,39 @@ endif()
189
214
 
190
215
  find_package(Threads REQUIRED)
191
216
 
217
+ # SCS_WITH_OPENMP and SCS_WITH_PARALLEL_PSD say what is built, which is not
218
+ # what was asked for when CMake does not find OpenMP. USE_OPENMP alone then
219
+ # gives a warning and libraries without OpenMP. With USE_PARALLEL_PSD the
220
+ # configuration stops, because no library would then have the parallel
221
+ # projection and the option would otherwise be dropped with no more than that
222
+ # warning. The libraries below link OpenMP::OpenMP_C, and the installed package
223
+ # asks for OpenMP, when SCS_WITH_OPENMP is ON.
224
+ set(SCS_WITH_OPENMP OFF)
225
+ set(SCS_WITH_PARALLEL_PSD OFF)
192
226
  if(USE_OPENMP)
193
227
  find_package(OpenMP)
194
228
  if(OpenMP_C_FOUND)
195
- # Link target used below via target_link_libraries.
229
+ set(SCS_WITH_OPENMP ON)
230
+ if(USE_PARALLEL_PSD)
231
+ # Takes effect in the libraries that are compiled with OpenMP.
232
+ list(APPEND COMPILER_OPTS USE_PARALLEL_PSD)
233
+ set(SCS_WITH_PARALLEL_PSD ON)
234
+ endif()
235
+ elseif(USE_PARALLEL_PSD)
236
+ message(FATAL_ERROR
237
+ "USE_PARALLEL_PSD requires OpenMP, which CMake did not find. "
238
+ "Install OpenMP for this compiler, or if it is installed tell "
239
+ "CMake where with -DOpenMP_ROOT=<folder> (needed for Homebrew's "
240
+ "libomp on macOS), or configure with -DUSE_PARALLEL_PSD=OFF")
196
241
  else()
197
- message(WARNING "OpenMP requested but not found by CMake")
242
+ message(WARNING
243
+ "OpenMP requested but not found by CMake: the libraries are built "
244
+ "without it. If OpenMP is installed, tell CMake where with "
245
+ "-DOpenMP_ROOT=<folder>")
198
246
  endif()
199
247
  endif()
248
+ message(STATUS "OpenMP parallelization is ${SCS_WITH_OPENMP}")
249
+ message(STATUS "Parallel PSD projection is ${SCS_WITH_PARALLEL_PSD}")
200
250
 
201
251
  if(USE_SPECTRAL_CONES)
202
252
  list(APPEND COMPILER_OPTS USE_SPECTRAL_CONES)
@@ -336,7 +386,7 @@ target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE ${COMPILER_OPTS})
336
386
  target_link_libraries(${${PROJECT_NAME}_DIRECT}
337
387
  PRIVATE ${LAPACK_LINK_LIBRARIES}
338
388
  $<$<NOT:$<PLATFORM_ID:Windows>>:m>
339
- $<$<BOOL:${OpenMP_C_FOUND}>:OpenMP::OpenMP_C>
389
+ $<$<BOOL:${SCS_WITH_OPENMP}>:OpenMP::OpenMP_C>
340
390
  Threads::Threads)
341
391
 
342
392
  set_target_properties(
@@ -381,7 +431,7 @@ target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE ${COMPILER_OPTS}
381
431
  target_link_libraries(${${PROJECT_NAME}_INDIRECT}
382
432
  PRIVATE $<$<NOT:$<PLATFORM_ID:Windows>>:m>
383
433
  ${LAPACK_LINK_LIBRARIES}
384
- $<$<BOOL:${OpenMP_C_FOUND}>:OpenMP::OpenMP_C>
434
+ $<$<BOOL:${SCS_WITH_OPENMP}>:OpenMP::OpenMP_C>
385
435
  Threads::Threads)
386
436
 
387
437
  set_target_properties(
@@ -428,7 +478,7 @@ if(USE_LAPACK)
428
478
  target_link_libraries(${${PROJECT_NAME}_DENSE}
429
479
  PRIVATE ${LAPACK_LINK_LIBRARIES}
430
480
  $<$<NOT:$<PLATFORM_ID:Windows>>:m>
431
- $<$<BOOL:${OpenMP_C_FOUND}>:OpenMP::OpenMP_C>
481
+ $<$<BOOL:${SCS_WITH_OPENMP}>:OpenMP::OpenMP_C>
432
482
  Threads::Threads)
433
483
 
434
484
  set_target_properties(
@@ -536,11 +586,13 @@ if(USE_CUDSS)
536
586
  find_package(CUDAToolkit REQUIRED)
537
587
  find_package(cudss REQUIRED)
538
588
 
539
- # Force 32-bit integers for cuDSS compatibility
589
+ # The cuDSS source supports 64-bit indices and the Makefile build accepts
590
+ # DLONG=1, but the CMake build has not been tested with them, so it refuses
591
+ # DLONG=ON.
540
592
  if(DLONG)
541
593
  message(
542
594
  FATAL_ERROR
543
- "cuDSS requires 32-bit integers. Set DLONG=OFF or do not use -DDLONG=ON"
595
+ "The CMake build of the cuDSS solver requires 32-bit integers (DLONG=OFF); the Makefile build accepts DLONG=1"
544
596
  )
545
597
  endif()
546
598
 
@@ -591,6 +643,68 @@ if(USE_CUDSS)
591
643
  set_property(GLOBAL APPEND PROPERTY SCS_TARGETS ${${PROJECT_NAME}_CUDSS})
592
644
  endif()
593
645
 
646
+ # GPU indirect method library (optional, requires the CUDA toolkit).
647
+ # The sources are plain C calling the CUDA runtime, cuBLAS and cuSPARSE, so
648
+ # CUDA does not have to be enabled as a language: FindCUDAToolkit is enough.
649
+ if(USE_GPU)
650
+ find_package(CUDAToolkit REQUIRED)
651
+
652
+ message(STATUS "Will install SCS-GPU (libscsgpuindir).")
653
+
654
+ set(GPUSRC ${LINSYS}/gpu)
655
+ set(GPUINDIRSRC ${LINSYS}/gpu/indirect)
656
+
657
+ set(${PROJECT_NAME}_GPU_INDIRECT ${PROJECT_NAME}gpuindir)
658
+ add_library(
659
+ ${${PROJECT_NAME}_GPU_INDIRECT}
660
+ ${${PROJECT_NAME}_HDR} ${${PROJECT_NAME}_SRC} ${GPUSRC}/gpu.c
661
+ ${GPUSRC}/gpu.h ${GPUINDIRSRC}/private.c ${GPUINDIRSRC}/private.h)
662
+
663
+ target_include_directories(
664
+ ${${PROJECT_NAME}_GPU_INDIRECT}
665
+ PRIVATE
666
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${GPUINDIRSRC};${CMAKE_CURRENT_SOURCE_DIR}/${GPUSRC};${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>"
667
+ )
668
+
669
+ target_include_directories(
670
+ ${${PROJECT_NAME}_GPU_INDIRECT}
671
+ PUBLIC ${SCS_PUBLIC_INCLUDE_DIRS})
672
+
673
+ target_compile_definitions(
674
+ ${${PROJECT_NAME}_GPU_INDIRECT}
675
+ PRIVATE ${COMPILER_OPTS} -DINDIRECT
676
+ $<$<BOOL:${GPU_TRANSPOSE_MAT}>:-DGPU_TRANSPOSE_MAT=1>)
677
+
678
+ target_link_libraries(
679
+ ${${PROJECT_NAME}_GPU_INDIRECT}
680
+ PRIVATE CUDA::cudart CUDA::cublas CUDA::cusparse
681
+ $<$<NOT:$<PLATFORM_ID:Windows>>:m>
682
+ ${LAPACK_LINK_LIBRARIES}
683
+ $<$<BOOL:${SCS_WITH_OPENMP}>:OpenMP::OpenMP_C>
684
+ Threads::Threads)
685
+
686
+ set_target_properties(
687
+ ${${PROJECT_NAME}_GPU_INDIRECT}
688
+ PROPERTIES VERSION ${scs_VERSION} SOVERSION ${SCS_ABI_VERSION}
689
+ PUBLIC_HEADER
690
+ "${${PROJECT_NAME}_PUBLIC_HDR}")
691
+
692
+ add_library(scs::${${PROJECT_NAME}_GPU_INDIRECT}
693
+ ALIAS ${${PROJECT_NAME}_GPU_INDIRECT})
694
+
695
+ install(
696
+ TARGETS ${${PROJECT_NAME}_GPU_INDIRECT}
697
+ EXPORT ${PROJECT_NAME}
698
+ COMPONENT runtime
699
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
700
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
701
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
702
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/scs")
703
+
704
+ set_property(GLOBAL APPEND PROPERTY SCS_TARGETS
705
+ ${${PROJECT_NAME}_GPU_INDIRECT})
706
+ endif()
707
+
594
708
  # Apple Accelerate library (optional, macOS only).
595
709
  if(APPLE AND USE_APPLE_ACCELERATE)
596
710
  if(DLONG)
@@ -626,7 +740,7 @@ if(APPLE AND USE_APPLE_ACCELERATE)
626
740
  target_link_libraries(
627
741
  ${${PROJECT_NAME}_ACCEL}
628
742
  PRIVATE ${ACCELERATE_FRAMEWORK}
629
- $<$<BOOL:${OpenMP_C_FOUND}>:OpenMP::OpenMP_C>
743
+ $<$<BOOL:${SCS_WITH_OPENMP}>:OpenMP::OpenMP_C>
630
744
  Threads::Threads)
631
745
 
632
746
  set_target_properties(
@@ -681,6 +795,14 @@ if(BUILD_TESTING)
681
795
  target_compile_definitions(${TEST_NAME} PRIVATE ${COMPILER_OPTS})
682
796
  target_link_libraries(${TEST_NAME} PRIVATE ${LINK_TARGET}
683
797
  ${SCS_TEST_LINK_LIBRARIES})
798
+ # OpenMP in the test when its library is built with it: the PSD tests then
799
+ # check the projection under several OpenMP threads (parallel with
800
+ # USE_PARALLEL_PSD, serial without), and skip for a library without OpenMP
801
+ # (scsmkl and scscudss do not link it)
802
+ get_target_property(_scs_test_libs ${LINK_TARGET} LINK_LIBRARIES)
803
+ if(SCS_WITH_OPENMP AND "${_scs_test_libs}" MATCHES "OpenMP::OpenMP_C")
804
+ target_link_libraries(${TEST_NAME} PRIVATE OpenMP::OpenMP_C)
805
+ endif()
684
806
  target_include_directories(
685
807
  ${TEST_NAME}
686
808
  PRIVATE
@@ -707,6 +829,12 @@ if(BUILD_TESTING)
707
829
  scs_add_test(run_tests_cudss scs::scscudss)
708
830
  endif()
709
831
 
832
+ # Builds anywhere the CUDA toolkit is present, but needs an actual device
833
+ # to run: on a GPU-less machine skip it with `ctest -E gpu`.
834
+ if(USE_GPU)
835
+ scs_add_test(run_tests_gpu_indirect scs::scsgpuindir)
836
+ endif()
837
+
710
838
  if(APPLE AND USE_APPLE_ACCELERATE)
711
839
  scs_add_test(run_tests_accelerate scs::scsaccel)
712
840
  endif()
@@ -21,6 +21,18 @@ make DLONG=1 USE_LAPACK=1
21
21
  make purge
22
22
  ```
23
23
 
24
+ > **The spectral-cone tests are skipped by default.** `USE_SPECTRAL_CONES`
25
+ > defaults to `0` (see `scs.mk`), so a default `make test` reports the
26
+ > spectral-cone tests as `skipped` (the summary line at the end of a run counts
27
+ > and names them) and exercises none of `src/spectral_cones/` — while still
28
+ > printing `ALL TESTS PASSED`. If you touch the log-determinant, nuclear-norm,
29
+ > sum-of-largest or ell1 cone code, build and test with the flag enabled:
30
+ >
31
+ > ```bash
32
+ > make test USE_SPECTRAL_CONES=1
33
+ > ./out/run_tests_direct
34
+ > ```
35
+
24
36
  ## Development Workflow
25
37
 
26
38
  1. Fork the repo and create a feature branch from `master`
@@ -45,5 +57,12 @@ make purge
45
57
  | `test/` | Test suite (minunit framework) |
46
58
  | `docs/src/` | Sphinx documentation source |
47
59
 
48
- See `CLAUDE.md` for architecture details and guides on adding new solver
49
- backends or cone types.
60
+ ## Where to Read Next
61
+
62
+ | Topic | Reference |
63
+ |-------|-----------|
64
+ | Algorithm, termination criteria, scaling | [`docs/src/algorithm/`](docs/src/algorithm/) ([online](https://www.cvxgrp.org/scs/algorithm/)) |
65
+ | Linear solver backends and the KKT system | [`docs/src/linear_solver/`](docs/src/linear_solver/) ([online](https://www.cvxgrp.org/scs/linear_solver/)) |
66
+ | **Adding a new linear solver backend** | [Implementing a new linear solver](https://www.cvxgrp.org/scs/linear_solver/#implementing-a-new-linear-solver) — implement `ScsLinSysWork` and the functions in `include/linsys.h`; see `linsys/` for seven worked examples |
67
+ | Supported cones and their data layout | [`docs/src/api/cones.rst`](docs/src/api/cones.rst) ([online](https://www.cvxgrp.org/scs/api/cones.html)) |
68
+ | Compile-time flags | [`docs/src/api/compile_flags.rst`](docs/src/api/compile_flags.rst) ([online](https://www.cvxgrp.org/scs/api/compile_flags.html)) |
data/vendor/scs/Makefile CHANGED
@@ -88,8 +88,9 @@ $(DIRSRC)/private.o: $(DIRSRC)/private.c $(DIRSRC)/private.h
88
88
  $(INDIRSRC)/private.o: $(INDIRSRC)/private.c $(INDIRSRC)/private.h
89
89
  $(DENSESRC)/private.o: $(DENSESRC)/private.c $(DENSESRC)/private.h
90
90
  $(MKLSRC)/private.o: $(MKLSRC)/private.c $(MKLSRC)/private.h
91
+ # --coverage is a host compiler option, so nvcc needs it via -Xcompiler.
91
92
  $(CUDSSSRC)/private.o: $(CUDSSSRC)/private.c $(CUDSSSRC)/private.h
92
- $(CUCC) $(INCLUDE) $(CUDSS_FLAGS) -I$(CUDSSSRC) -c $(CUDSSSRC)/private.c -o $@
93
+ $(CUCC) $(INCLUDE) $(patsubst --coverage,-Xcompiler=--coverage,$(CUSTOM_FLAGS)) $(CUDSS_FLAGS) -I$(CUDSSSRC) -c $(CUDSSSRC)/private.c -o $@
93
94
  $(ACCELSRC)/private.o: $(ACCELSRC)/private.c $(ACCELSRC)/private.h
94
95
  $(LINSYS)/scs_matrix.o: $(LINSYS)/scs_matrix.c $(LINSYS)/scs_matrix.h
95
96
  $(LINSYS)/csparse.o: $(LINSYS)/csparse.c $(LINSYS)/csparse.h
@@ -147,7 +148,7 @@ $(OUT)/libscsmkl.$(SHARED): $(SCS_MKL_O) $(SCS_OBJECTS) $(MKLSRC)/private.o $(LI
147
148
  $(call link_shared,$(MKLFLAGS))
148
149
 
149
150
  $(OUT)/libscscudss.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(CUDSSSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
150
- $(call link_shared,$(CULDFLAGS))
151
+ $(call link_shared,$(BLASLDFLAGS) $(CUDSS_LDFLAGS))
151
152
 
152
153
  $(OUT)/libscsaccel.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(ACCELSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
153
154
  $(call link_shared,-framework Accelerate)
@@ -252,7 +253,7 @@ $(OUT)/demo_socp_gpu_indirect: test/random_socp_prob.c $(OUT)/libscsgpuindir.a
252
253
 
253
254
  .PHONY: clean purge
254
255
  clean:
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
256
+ @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 $(CUDSSSRC)/*.o $(ACCELSRC)/*.o $(GPUDIR)/*.o $(GPUINDIR)/*.o $(LINSYS)/gpu/*.o src/spectral_cones/*.o src/spectral_cones/*/*.o
256
257
  @rm -rf $(OUT)/*.dSYM
257
258
  @rm -rf matlab/*.mex*
258
259
  @rm -rf .idea
data/vendor/scs/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/scs.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/scs)
9
9
 
10
10
  SCS (`splitting conic solver`) is a numerical optimization package for solving
11
- large-scale convex cone problems. The current version is `3.3.1`.
11
+ large-scale convex cone problems. The current version is `3.3.2`.
12
12
 
13
13
  The full documentation is available [here](https://www.cvxgrp.org/scs/).
14
14
 
@@ -18,7 +18,7 @@ If you wish to cite SCS please cite the papers listed [here](https://www.cvxgrp.
18
18
 
19
19
  SCS solves convex cone programs of the form:
20
20
 
21
- ```
21
+ ```text
22
22
  minimize (1/2) x'Px + c'x
23
23
  subject to Ax + s = b, s in K
24
24
  ```
@@ -26,19 +26,23 @@ subject to Ax + s = b, s in K
26
26
  where `K` is a product of convex cones. It uses an operator-splitting method
27
27
  (ADMM) with Anderson acceleration to achieve fast convergence.
28
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).
29
+ **Supported cones:** zero/linear (LP), box, second-order (SOCP), semidefinite
30
+ (SDP), complex semidefinite, exponential, power, and spectral cones
31
+ (log-determinant, nuclear norm, ell1-norm, sum-of-largest eigenvalues).
32
32
 
33
33
  ## Features
34
34
 
35
35
  - Multiple linear solver backends: sparse direct (QDLDL), dense direct (LAPACK),
36
- iterative (CG), Intel MKL Pardiso, Apple Accelerate (macOS), NVIDIA cuDSS, GPU
36
+ iterative (CG), Intel MKL Pardiso, Apple Accelerate (macOS), NVIDIA cuDSS
37
+ (GPU direct), GPU conjugate gradient
37
38
  - Anderson acceleration for faster convergence, including solve diagnostics
38
39
  - Problem data normalization/equilibration for numerical stability
40
+ - Adaptive dual scaling, with per-row diagonal rescaling driven by residual
41
+ profiles (`adaptive_diag_scale`, on by default)
39
42
  - Warm-starting and incremental `b`/`c` updates via `scs_update`
40
43
  - Ctrl-C signal handling for graceful interruption
41
- - Configurable precision (`float`/`double`) and index type (`int`/`long long`)
44
+ - Configurable index type (`int`/`long long`); single precision (`float`) is
45
+ experimental and not covered by the test suite
42
46
  - MIT licensed
43
47
 
44
48
  ## Building from Source
@@ -52,6 +56,10 @@ make test # Build test binaries
52
56
  ./out/run_tests_indirect
53
57
  ```
54
58
 
59
+ Note that the spectral-cone tests are skipped unless SCS is built with
60
+ `USE_SPECTRAL_CONES=1` (see the flag table below); a default `make test` run
61
+ reports them as `skipped`.
62
+
55
63
  ### CMake
56
64
 
57
65
  ```bash
@@ -67,9 +75,10 @@ ctest
67
75
  |------|---------|-------------|
68
76
  | `USE_LAPACK` | `1` | Enable BLAS/LAPACK (required for SDP support) |
69
77
  | `DLONG` | `0` | Use 64-bit integer indexing |
70
- | `SFLOAT` | `0` | Use single-precision floats |
78
+ | `SFLOAT` | `0` | Use single-precision floats (experimental, not covered by the test suite; see the docs before enabling) |
71
79
  | `USE_SPECTRAL_CONES` | `0` | Enable spectral cone support (requires LAPACK) |
72
80
  | `USE_OPENMP` | `0` | Enable OpenMP parallelization |
81
+ | `USE_PARALLEL_PSD` | `0` | Project PSD blocks in parallel (requires OpenMP and LAPACK; see the docs before enabling) |
73
82
 
74
83
  Example: `make DLONG=1 USE_LAPACK=1`
75
84
 
@@ -77,23 +86,25 @@ Example: `make DLONG=1 USE_LAPACK=1`
77
86
 
78
87
  SCS has interfaces for several languages:
79
88
 
80
- - **Python:** `pip install scs` ([PyPI](https://pypi.org/project/scs/))
89
+ - **Python:** [scs-python](https://github.com/bodono/scs-python) (`pip install scs`, [PyPI](https://pypi.org/project/scs/))
81
90
  - **Julia:** [SCS.jl](https://github.com/jump-dev/SCS.jl)
82
91
  - **R:** [scs](https://cran.r-project.org/package=scs)
83
- - **MATLAB:** See the [documentation](https://www.cvxgrp.org/scs/install/matlab.html)
92
+ - **MATLAB:** [scs-matlab](https://github.com/bodono/scs-matlab) ([install guide](https://www.cvxgrp.org/scs/install/matlab.html))
84
93
  - **Ruby:** [scs-ruby](https://github.com/ankane/scs-ruby)
85
94
 
86
- SCS is the default solver in [CVXPY](https://www.cvxpy.org/).
95
+ In [CVXPY](https://www.cvxpy.org/), SCS is the default solver for semidefinite,
96
+ exponential-cone and power-cone problems (Clarabel handles LPs and SOCPs, OSQP
97
+ handles QPs).
87
98
 
88
99
  ## Project Structure
89
100
 
90
- ```
101
+ ```text
91
102
  include/ Public API and internal headers
92
103
  src/ Core solver implementation
93
104
  linsys/ Linear solver backends (pluggable architecture)
94
- cpu/direct/ Sparse Cholesky (QDLDL, default)
105
+ cpu/direct/ Sparse LDLt (AMD ordering + QDLDL, default)
95
106
  cpu/indirect/ Conjugate gradient
96
- cpu/dense/ Dense LU (LAPACK dgetrf, for small problems)
107
+ cpu/dense/ Dense Cholesky on the Gram reduction (LAPACK dpotrf)
97
108
  mkl/direct/ Intel MKL Pardiso
98
109
  accelerate/direct/ Apple Accelerate sparse LDLt (macOS)
99
110
  cudss/direct/ NVIDIA cuDSS
@@ -20,6 +20,21 @@ extern "C" {
20
20
  #endif
21
21
  #endif
22
22
 
23
+ /* Workspace for the eigendecomposition of one matrix cone at a time (cones.c):
24
+ * one per thread of the PSD projection. */
25
+ typedef struct SCS_PSD_WORK ScsPsdWork;
26
+ #ifdef USE_LAPACK
27
+ struct SCS_PSD_WORK {
28
+ scs_float *Xs, *Z, *e, *work;
29
+ scs_float *gamma; /* PSD diagonal-congruence factors */
30
+ scs_complex_float *cXs, *cZ, *cwork;
31
+ blas_int *isuppz, *iwork;
32
+ /* work-array sizes, those of psd_tw[0] in every thread (lcwork is 0 in a
33
+ * thread with no complex block) */
34
+ blas_int lwork, lcwork, liwork;
35
+ };
36
+ #endif
37
+
23
38
  /* private data to help cone projection step */
24
39
  struct SCS_CONE_WORK {
25
40
  /*
@@ -37,8 +52,6 @@ struct SCS_CONE_WORK {
37
52
  * congruence X -> DXD). enforce_cone_boundaries fits this form for
38
53
  * PSD blocks instead of collapsing them to one value. */
39
54
  scs_int *cone_boundaries_psd_n;
40
- /* scratch for PSD diagonal-congruence factors, length max PSD dim */
41
- scs_float *psd_gamma;
42
55
  scs_int scaled_cones; /* boolean, whether the cones have been scaled */
43
56
  scs_float *s; /* used for Moreau decomposition in projection */
44
57
  scs_int m; /* total length of cone */
@@ -46,13 +59,17 @@ struct SCS_CONE_WORK {
46
59
  scs_float box_t_warm_start;
47
60
  scs_float *r_box_inv; /* precomputed 1/r_box[j] for box cone Newton */
48
61
 
49
- #ifdef USE_LAPACK
50
- /* workspace for eigenvector decompositions: */
51
- scs_float *Xs, *Z, *e, *work, *rwork;
52
- scs_complex_float *cXs, *cZ, *cwork;
53
- blas_int *isuppz, *iwork;
54
- blas_int lwork, lcwork, lrwork, liwork;
55
- #endif
62
+ /* Eigendecomposition workspaces (with LAPACK), one per thread: psd_tw[0]
63
+ * serves every matrix cone, psd_tw[t] the PSD blocks of list t. */
64
+ ScsPsdWork *psd_tw;
65
+ /* PSD blocks: block b < ssize is real block b, else complex block b - ssize,
66
+ * at offset psd_off[b] from the first PSD entry (psd_len entries in all).
67
+ * List t of psd_nthreads is psd_blk[psd_tptr[t]] ..
68
+ * psd_blk[psd_tptr[t + 1] - 1], the blocks of one thread (a smaller team
69
+ * shares the lists out). psd_nthreads is 1 for a serial projection, one
70
+ * list with all blocks in order, and 0 without PSD blocks. */
71
+ scs_int psd_nthreads, psd_len;
72
+ scs_int *psd_blk, *psd_tptr, *psd_off;
56
73
 
57
74
  #ifdef USE_SPECTRAL_CONES
58
75
  /* if the projection onto the logarithmic cone should be warmstarted*/
@@ -98,6 +115,7 @@ void SCS(set_r_y)(const ScsConeWork *c, scs_float scale, scs_float *r_y);
98
115
  void SCS(enforce_cone_boundaries)(const ScsConeWork *c, scs_float *vec,
99
116
  scs_float (*f)(const scs_float *, scs_int),
100
117
  scs_int psd_rank1);
118
+ void SCS(reset_cone_cache)(ScsConeWork *c);
101
119
 
102
120
  #ifdef __cplusplus
103
121
  }
@@ -23,7 +23,7 @@ extern "C" {
23
23
 
24
24
  /* SCS VERSION NUMBER ---------------------------------------------- */
25
25
  /* string literals automatically null-terminated */
26
- #define SCS_VERSION ("3.3.1")
26
+ #define SCS_VERSION ("3.3.2")
27
27
 
28
28
  /* verbosity level */
29
29
  #ifndef VERBOSITY
@@ -37,7 +37,15 @@ extern "C" {
37
37
  #define EPS_ABS (1E-4)
38
38
  #define EPS_INFEAS (1E-7)
39
39
  #define ALPHA (1.5)
40
+ /* Back-substitution through the KKT factorization loses about eps / rho_x
41
+ * relative accuracy in x, where eps is the machine precision. Single precision
42
+ * cannot afford 1e-6: even min x s.t. x >= 2 stalls at an 8% primal residual.
43
+ * 1e-2 leaves that error around 1e-5, below the default eps_abs and eps_rel. */
44
+ #ifdef SFLOAT
45
+ #define RHO_X (1E-2)
46
+ #else
40
47
  #define RHO_X (1E-6)
48
+ #endif
41
49
  #define SCALE (0.1)
42
50
  #define VERBOSE (1)
43
51
  #define NORMALIZE (1)
@@ -251,10 +259,12 @@ static inline void *scs_calloc(size_t count, size_t size) {
251
259
  /* Dynamic diagonal rescaling (stgs->adaptive_diag_scale). Row multipliers
252
260
  * move by at most (profile ratio)^DIAG_SCALE_DAMP per update and live in
253
261
  * [DIAG_SCALE_MULT_MIN, DIAG_SCALE_MULT_MAX] around the scalar scale. An
254
- * update fires when the scalar scale updates, or when some damped
255
- * *clamped* step alone exceeds sqrt(10) (a railed scalar must not freeze
256
- * the diagonal; a railed multiplier must not keep triggering updates it
257
- * cannot take). */
262
+ * update fires when the scalar scale updates, or when some multiplier, as
263
+ * it would be installed (damped, clamped, and after its cone block has been
264
+ * given its form), would move by more than sqrt(10) (a railed scalar must
265
+ * not freeze the diagonal; a railed multiplier must not keep triggering
266
+ * updates it cannot take; a row whose step its block averages away must
267
+ * not trigger one either). */
258
268
  #define DIAG_SCALE_DAMP (0.25)
259
269
  #define DIAG_SCALE_MULT_MIN (1e-3)
260
270
  #define DIAG_SCALE_MULT_MAX (1e3)
@@ -264,7 +274,17 @@ static inline void *scs_calloc(size_t count, size_t size) {
264
274
  #define DEN_FLOOR_FRAC (1e-3)
265
275
 
266
276
  /* --- Conjugate gradient (CG) parameters, only used with indirect solver --- */
277
+ /* Accuracy of the most accurate CG solves (the cold solve for g, and the floor
278
+ * of the warm ones). Single precision cannot reach 1e-12: a CG asked for it
279
+ * runs to its iteration limit on every solve and its rounding errors then
280
+ * reach the iterates (issue_499's infeasibility certificate stalled with
281
+ * tau at rounding level). 1e-6 is about ten times float's machine epsilon;
282
+ * 1e-7 also passes the test suite, 1e-5 starts losing accuracy. */
283
+ #ifdef SFLOAT
284
+ #define CG_BEST_TOL (1e-6)
285
+ #else
267
286
  #define CG_BEST_TOL (1e-12)
287
+ #endif
268
288
  /* Each CG solve targets tol = CG_TOL_FACTOR * current_residual. Smaller
269
289
  * values give more accurate CG solves at the cost of more CG iterations.
270
290
  * With deflation making inner accuracy cheap, 0.03 measured optimal on a
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * Public header containing the outward facing SCS API. It includes all the
3
- * input/output data structs and the API functions. Make sure this file and
4
- * `scs_types.h` are somewhere appropriate and then use `#include "scs.h"` to
5
- * access the SCS public API.
3
+ * input/output data structs and the API functions. Make sure this file,
4
+ * `scs_types.h` and `aa_stats.h` are somewhere appropriate and then use
5
+ * `#include "scs.h"` to access the SCS public API.
6
6
  */
7
7
 
8
8
  #ifndef SCS_H_GUARD
@@ -67,8 +67,8 @@ typedef struct {
67
67
  scs_int adaptive_scale;
68
68
  /** Dynamic diagonal rescaling from residual profiles: 0 = off,
69
69
  * 1 = per-row (rescales the R_y diagonal from the row-wise primal
70
- * residual profile; uniform within non-polyhedral cone blocks; the
71
- * default). Requires `adaptive_scale` (silently disabled without
70
+ * residual profile; one value per non-polyhedral cone block, except
71
+ * that a real PSD block gets a rank-one form; the default). Requires `adaptive_scale` (silently disabled without
72
72
  * it). */
73
73
  scs_int adaptive_diag_scale;
74
74
  /** Primal constraint scaling factor. */
@@ -200,7 +200,7 @@ typedef struct {
200
200
  char status[128];
201
201
  /** Linear system solver used. */
202
202
  char lin_sys_solver[128];
203
- /** Status as scs_int, defined in glbopts.h. */
203
+ /** Status as scs_int, one of the exit flags defined at the top of scs.h. */
204
204
  scs_int status_val;
205
205
  /** Number of updates to scale. */
206
206
  scs_int scale_updates;
@@ -301,7 +301,8 @@ scs_int scs_update(ScsWork *w, scs_float *b, scs_float *c);
301
301
  * @param warm_start Whether to use the entries of `sol` as warm-start for
302
302
  * the solve.
303
303
  *
304
- * @return Flag containing problem status (see \a glbopts.h).
304
+ * @return Flag containing problem status (one of the exit flags
305
+ * defined at the top of \a scs.h).
305
306
  */
306
307
  scs_int scs_solve(ScsWork *w, ScsSolution *sol, ScsInfo *info,
307
308
  scs_int warm_start);
@@ -324,7 +325,8 @@ void scs_finish(ScsWork *w);
324
325
  * @param sol Solution will be stored here. If members `x`, `y`, `s` are
325
326
  * NULL then SCS will allocate memory for them.
326
327
  * @param info Information about the solve will be stored here.
327
- * @return Flag containing problem status (see \a glbopts.h).
328
+ * @return Flag containing problem status (one of the exit flags
329
+ * defined at the top of \a scs.h).
328
330
  */
329
331
  scs_int scs(const ScsData *d, const ScsCone *k, const ScsSettings *stgs,
330
332
  ScsSolution *sol, ScsInfo *info);
@@ -88,9 +88,10 @@ struct SCS_WORK {
88
88
  scs_int last_scale_update_iter, n_log_scale_factor, scale_updates;
89
89
  /* per-row scale multipliers on R_y, size m (adaptive_diag_scale >= 1) */
90
90
  scs_float *scale_mults;
91
+ /* the multipliers the next update would install, size m (scratch) */
92
+ scs_float *scale_mults_next;
91
93
  /* floor on the row-profile denominators, see row_rel_res */
92
94
  scs_float den_floor;
93
- /* per-column multipliers on rho_x, size n (adaptive_diag_scale >= 2) */
94
95
  /* AA stats */
95
96
  scs_float aa_norm;
96
97
  scs_int rejected_accel_steps, accepted_accel_steps;