scs 0.5.1 → 0.5.2

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/scs/ffi.rb +2 -0
  4. data/lib/scs/version.rb +1 -1
  5. data/vendor/scs/CITATION.cff +2 -2
  6. data/vendor/scs/CMakeLists.txt +136 -6
  7. data/vendor/scs/Makefile +53 -3
  8. data/vendor/scs/README.md +1 -1
  9. data/vendor/scs/include/cones.h +47 -2
  10. data/vendor/scs/include/glbopts.h +1 -1
  11. data/vendor/scs/include/scs.h +29 -0
  12. data/vendor/scs/include/scs_blas.h +4 -0
  13. data/vendor/scs/include/scs_types.h +3 -1
  14. data/vendor/scs/include/util_spectral_cones.h +45 -0
  15. data/vendor/scs/linsys/cpu/direct/private.c +3 -3
  16. data/vendor/scs/linsys/cpu/direct/private.h +2 -1
  17. data/vendor/scs/linsys/csparse.c +1 -1
  18. data/vendor/scs/linsys/cudss/direct/private.c +279 -0
  19. data/vendor/scs/linsys/cudss/direct/private.h +63 -0
  20. data/vendor/scs/linsys/external/qdldl/qdldl_types.h +1 -1
  21. data/vendor/scs/linsys/gpu/indirect/private.c +14 -21
  22. data/vendor/scs/scs.mk +17 -2
  23. data/vendor/scs/src/aa.c +8 -12
  24. data/vendor/scs/src/cones.c +783 -12
  25. data/vendor/scs/src/rw.c +15 -1
  26. data/vendor/scs/src/scs.c +4 -0
  27. data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_IPM.c +660 -0
  28. data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_Newton.c +279 -0
  29. data/vendor/scs/src/spectral_cones/logdeterminant/log_cone_wrapper.c +205 -0
  30. data/vendor/scs/src/spectral_cones/logdeterminant/logdet_cone.c +143 -0
  31. data/vendor/scs/src/spectral_cones/nuclear/ell1_cone.c +221 -0
  32. data/vendor/scs/src/spectral_cones/nuclear/nuclear_cone.c +99 -0
  33. data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_cone.c +196 -0
  34. data/vendor/scs/src/spectral_cones/sum-largest/sum_largest_eval_cone.c +140 -0
  35. data/vendor/scs/src/spectral_cones/util_spectral_cones.c +52 -0
  36. data/vendor/scs/test/problems/complex_PSD.h +83 -0
  37. data/vendor/scs/test/rng.h +4 -4
  38. data/vendor/scs/test/run_tests.c +25 -0
  39. data/vendor/scs/test/spectral_cones_problems/exp_design.h +141 -0
  40. data/vendor/scs/test/spectral_cones_problems/graph_partitioning.h +275 -0
  41. data/vendor/scs/test/spectral_cones_problems/robust_pca.h +253 -0
  42. data/vendor/scs/test/spectral_cones_problems/several_logdet_cones.h +222 -0
  43. data/vendor/scs/test/spectral_cones_problems/several_nuc_cone.h +285 -0
  44. data/vendor/scs/test/spectral_cones_problems/several_sum_largest.h +420 -0
  45. metadata +21 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0383039079716cc0cd7087291d768ed2e9e5f615b78211a96e850e068c89e6bb'
4
- data.tar.gz: 0dc5bd791bafcf2846e66e90ba7ac88fa93665e1b024c1041123df4e4c279007
3
+ metadata.gz: 5f6156bd39776692e6bf684208d4401859c8b76cbff5b031866a0e269ae66893
4
+ data.tar.gz: f2316371287f4b2492509950591bd763a08dc142af46e71f770e1a68897a566a
5
5
  SHA512:
6
- metadata.gz: 6268655afd2200a7132125d86e4bde71c36325a8741857ed38a3b6e07686a042b310771f84df57e6b1756c00cc1c8ed1bc61b2e604b71133ba98a87471d45931
7
- data.tar.gz: fce49c2615c517adb0d13362a053c3dd2534a4579fc9f1bc5a219c21ac471833e61827ac8587ebb8a07001350b93eca5f820166d8a638e47d8e45bc279c83c72
6
+ metadata.gz: ee213ecedba119f6a551a9df9afb634f18dba8f022817baead85c77c9befd82c33690f942f6e5be0070f20a4ef3331eab289d8d3fffe5c1a801dbc66ce99efae
7
+ data.tar.gz: '071879f9a45ffc9c990e3510926c028f7f33ab199e13898325da87ff368eb19463b43feca04c5c296026150ae46aa86711098d15be4792f11c0bee1ac6e6993c'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.5.2 (2025-08-13)
2
+
3
+ - Updated SCS to 3.2.8
4
+
1
5
  ## 0.5.1 (2025-05-04)
2
6
 
3
7
  - Fixed memory management
data/lib/scs/ffi.rb CHANGED
@@ -49,6 +49,8 @@ module SCS
49
49
  "scs_int qsize",
50
50
  "scs_int *s",
51
51
  "scs_int ssize",
52
+ "scs_int *cs",
53
+ "scs_int cssize",
52
54
  "scs_int ep",
53
55
  "scs_int ed",
54
56
  "scs_float *p",
data/lib/scs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SCS
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -9,8 +9,8 @@ authors:
9
9
  given-names: "Neal"
10
10
  - family-names: "Boyd"
11
11
  given-names: "Stephen"
12
- title: "SCS: Spltting Conic Solver"
13
- version: 3.2.7
12
+ title: "SCS: Splitting Conic Solver"
13
+ version: 3.2.8
14
14
  date-released: 2023
15
15
  url: "https://github.com/cvxgrp/scs"
16
16
 
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.5)
6
6
  project(
7
7
  scs
8
8
  LANGUAGES C
9
- VERSION 3.2.7)
9
+ VERSION 3.2.8)
10
10
 
11
11
  # Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful
12
12
  # macros. See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
@@ -124,10 +124,20 @@ message(STATUS "Read/write functionality is NOT ${NO_READ_WRITE}")
124
124
  option(USE_LAPACK "Whether to use BLAS/LAPACK" ON)
125
125
  message(STATUS "BLAS/LAPACK usage is ${USE_LAPACK}")
126
126
 
127
+ # spectral cones
128
+ option(USE_SPECTRAL_CONES "Whether to use spectral cones (requires LAPACK)" OFF)
129
+ if(USE_SPECTRAL_CONES AND NOT USE_LAPACK)
130
+ message(FATAL_ERROR "USE_SPECTRAL_CONES requires USE_LAPACK to be ON")
131
+ endif()
132
+
127
133
  # Enable OpenMP support
128
134
  option(USE_OPENMP "Compile with OpenMP support" OFF)
129
135
  message(STATUS "OpenMP parallelization is ${USE_OPENMP}")
130
136
 
137
+ # Enable cuDSS support
138
+ option(USE_CUDSS "Compile with cuDSS support" OFF)
139
+ message(STATUS "cuDSS support is ${USE_CUDSS}")
140
+
131
141
  set(COMPILER_OPTS "-DCTRLC")
132
142
  set(LAPACK_LINK_LIBRARIES "")
133
143
 
@@ -154,7 +164,7 @@ if(NO_READ_WRITE)
154
164
  set(COMPILER_OPTS "-DNO_READ_WRITE=1 ${COMPILER_OPTS}")
155
165
  endif()
156
166
 
157
- if (USE_LAPACK)
167
+ if(USE_LAPACK)
158
168
  set(COMPILER_OPTS "-DUSE_LAPACK ${COMPILER_OPTS}")
159
169
  list(APPEND LAPACK_LINK_LIBRARIES "blas" "lapack")
160
170
  endif()
@@ -163,6 +173,19 @@ if(USE_OPENMP)
163
173
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
164
174
  endif()
165
175
 
176
+ # Flags for spectral cones.
177
+ if(USE_SPECTRAL_CONES)
178
+ set(COMPILER_OPTS "-DUSE_SPECTRAL_CONES ${COMPILER_OPTS}")
179
+ endif()
180
+
181
+ if(USE_SPECTRAL_TIMING_FLAG)
182
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSPECTRAL_TIMING_FLAG")
183
+ endif()
184
+
185
+ if(USE_SPECTRAL_DEBUG)
186
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSPECTRAL_DEBUG")
187
+ endif()
188
+
166
189
  message(STATUS "COMPILER_OPTS = ${COMPILER_OPTS}")
167
190
  message(STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
168
191
 
@@ -189,6 +212,23 @@ set(${PROJECT_NAME}_SRC
189
212
  ${LINSYS}/csparse.c
190
213
  ${LINSYS}/scs_matrix.c)
191
214
 
215
+ # Spectral source files
216
+ set(SPECTRAL_SRC
217
+ src/spectral_cones/logdeterminant/log_cone_Newton.c
218
+ src/spectral_cones/logdeterminant/log_cone_IPM.c
219
+ src/spectral_cones/logdeterminant/log_cone_wrapper.c
220
+ src/spectral_cones/logdeterminant/logdet_cone.c
221
+ src/spectral_cones/nuclear/ell1_cone.c
222
+ src/spectral_cones/nuclear/nuclear_cone.c
223
+ src/spectral_cones/sum-largest/sum_largest_cone.c
224
+ src/spectral_cones/sum-largest/sum_largest_eval_cone.c
225
+ src/spectral_cones/util_spectral_cones.c)
226
+
227
+ # Conditionally add spectral files
228
+ if(USE_SPECTRAL_CONES)
229
+ list(APPEND ${PROJECT_NAME}_SRC ${SPECTRAL_SRC})
230
+ endif()
231
+
192
232
  # Common header files
193
233
  set(${PROJECT_NAME}_HDR
194
234
  include/aa.h
@@ -207,6 +247,13 @@ set(${PROJECT_NAME}_HDR
207
247
  ${LINSYS}/csparse.h
208
248
  ${LINSYS}/scs_matrix.h)
209
249
 
250
+ # Spectral header files
251
+ set(SPECTRAL_HDR include/util_spectral_cones.h)
252
+
253
+ if(USE_SPECTRAL_CONES)
254
+ list(APPEND ${PROJECT_NAME}_HDR ${SPECTRAL_HDR})
255
+ endif()
256
+
210
257
  # get all the c file in amd/external
211
258
  file(GLOB ${PROJECT_NAME}_AMD_EXTERNAL_SRC ${EXTERNAL}/amd/*.c)
212
259
 
@@ -245,7 +292,8 @@ target_include_directories(
245
292
  target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE ${COMPILER_OPTS})
246
293
 
247
294
  # The library depends on math (m) and (optionally) blas and lapack
248
- target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE m ${LAPACK_LINK_LIBRARIES})
295
+ target_link_libraries(${${PROJECT_NAME}_DIRECT}
296
+ PRIVATE m ${LAPACK_LINK_LIBRARIES})
249
297
 
250
298
  # Set some properties
251
299
  set_target_properties(
@@ -293,7 +341,8 @@ target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE ${COMPILER_OPTS}
293
341
  -DINDIRECT)
294
342
 
295
343
  # The library depends on math (m) and (optionally) blas and lapack
296
- target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC m ${LAPACK_LINK_LIBRARIES})
344
+ target_link_libraries(${${PROJECT_NAME}_INDIRECT}
345
+ PUBLIC m ${LAPACK_LINK_LIBRARIES})
297
346
 
298
347
  # Set some properties
299
348
  set_target_properties(
@@ -347,8 +396,8 @@ if(DEFINED ENV{MKLROOT})
347
396
  target_compile_definitions(${${PROJECT_NAME}_MKL} PRIVATE ${COMPILER_OPTS})
348
397
  # See:
349
398
  # https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html
350
- # This is probably not correct for other systems. TODO: make SCS-MKL
351
- # work for all combinations of platform / compiler / threading options.
399
+ # This is probably not correct for other systems. TODO: make SCS-MKL work for
400
+ # all combinations of platform / compiler / threading options.
352
401
  target_link_options(${${PROJECT_NAME}_MKL} PRIVATE "LINKER:--no-as-needed")
353
402
  target_link_directories(${${PROJECT_NAME}_MKL} PRIVATE $ENV{MKLROOT}/lib)
354
403
  target_link_libraries(
@@ -389,6 +438,71 @@ endif()
389
438
 
390
439
  # ##############################################################################
391
440
 
441
+ # If cuDSS is enabled and environment variables are set, install the cuDSS
442
+ # version
443
+ if(USE_CUDSS)
444
+ find_package(CUDAToolkit REQUIRED)
445
+ find_package(cudss REQUIRED)
446
+
447
+ # Force 32-bit integers for cuDSS compatibility
448
+ if(DLONG)
449
+ message(
450
+ FATAL_ERROR
451
+ "cuDSS requires 32-bit integers. Set DLONG=OFF or do not use -DDLONG=ON"
452
+ )
453
+ endif()
454
+
455
+ message(STATUS "Will install SCS-cuDSS (libscscudss).")
456
+
457
+ set(CUDSSSRC ${LINSYS}/cudss/direct)
458
+
459
+ # Here we compile the direct cuDSS library
460
+ set(${PROJECT_NAME}_CUDSS ${PROJECT_NAME}cudss)
461
+ add_library(
462
+ ${${PROJECT_NAME}_CUDSS} ${${PROJECT_NAME}_HDR} ${${PROJECT_NAME}_SRC}
463
+ ${CUDSSSRC}/private.c ${CUDSSSRC}/private.h)
464
+
465
+ target_include_directories(
466
+ ${${PROJECT_NAME}_CUDSS}
467
+ PRIVATE
468
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${CUDSSSRC};${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>"
469
+ )
470
+
471
+ target_include_directories(
472
+ ${${PROJECT_NAME}_CUDSS}
473
+ PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
474
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
475
+
476
+ target_compile_definitions(${${PROJECT_NAME}_CUDSS} PRIVATE ${COMPILER_OPTS})
477
+
478
+ target_link_libraries(
479
+ ${${PROJECT_NAME}_CUDSS}
480
+ PRIVATE CUDA::cudart cudss $<$<NOT:$<PLATFORM_ID:Windows>>:m>
481
+ ${LAPACK_LINK_LIBRARIES})
482
+
483
+ # Set some properties
484
+ set_target_properties(
485
+ ${${PROJECT_NAME}_CUDSS}
486
+ PROPERTIES VERSION ${scs_VERSION} PUBLIC_HEADER
487
+ "${${PROJECT_NAME}_PUBLIC_HDR}")
488
+
489
+ add_library(scs::${${PROJECT_NAME}_CUDSS} ALIAS ${${PROJECT_NAME}_CUDSS})
490
+
491
+ # Install the library
492
+ install(
493
+ TARGETS ${${PROJECT_NAME}_CUDSS}
494
+ EXPORT ${PROJECT_NAME}
495
+ COMPONENT runtime
496
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
497
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
498
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
499
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/scs")
500
+
501
+ # Add the cuDSS method to the set of the compiled targets
502
+ set_property(GLOBAL APPEND PROPERTY SCS_TARGETS ${${PROJECT_NAME}_CUDSS})
503
+ endif()
504
+
505
+ # ##############################################################################
392
506
  # Install the .cmake file. It is possible to link scs o consumer libraries.
393
507
  include(InstallBasicPackageFiles)
394
508
  install_basic_package_files(
@@ -451,4 +565,20 @@ if(BUILD_TESTING)
451
565
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
452
566
  endif()
453
567
 
568
+ if(USE_CUDSS)
569
+ add_executable(run_tests_cudss test/run_tests.c)
570
+ target_compile_definitions(run_tests_cudss PRIVATE ${COMPILER_OPTS})
571
+ target_link_libraries(run_tests_cudss PRIVATE scs::scscudss)
572
+ target_include_directories(
573
+ run_tests_cudss
574
+ PRIVATE
575
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test;${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>"
576
+ )
577
+
578
+ add_test(
579
+ NAME run_tests_cudss
580
+ COMMAND run_tests_cudss
581
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
582
+ endif()
583
+
454
584
  endif()
data/vendor/scs/Makefile CHANGED
@@ -1,7 +1,33 @@
1
1
  # MAKEFILE for scs
2
2
  include scs.mk
3
3
 
4
- SCS_OBJECTS = src/util.o src/cones.o src/exp_cone.o src/aa.o src/rw.o src/linalg.o src/ctrlc.o src/scs_version.o src/normalize.o
4
+ # Base object files always included
5
+ BASE_SCS_OBJECTS = \
6
+ src/util.o src/cones.o src/exp_cone.o src/aa.o src/rw.o src/linalg.o src/ctrlc.o src/scs_version.o src/normalize.o
7
+
8
+ # Spectral cones files, only included if USE_SPECTRAL_CONES=1
9
+ SPECTRAL_CONES_OBJECTS = \
10
+ src/spectral_cones/logdeterminant/log_cone_Newton.o \
11
+ src/spectral_cones/logdeterminant/log_cone_IPM.o \
12
+ src/spectral_cones/logdeterminant/log_cone_wrapper.o \
13
+ src/spectral_cones/logdeterminant/logdet_cone.o \
14
+ src/spectral_cones/nuclear/ell1_cone.o \
15
+ src/spectral_cones/nuclear/nuclear_cone.o \
16
+ src/spectral_cones/sum-largest/sum_largest_cone.o \
17
+ src/spectral_cones/sum-largest/sum_largest_eval_cone.o \
18
+ src/spectral_cones/util_spectral_cones.o
19
+
20
+ # Now decide which objects to include:
21
+ ifneq ($(USE_LAPACK),0)
22
+ ifneq ($(USE_SPECTRAL_CONES),0)
23
+ SCS_OBJECTS = $(BASE_SCS_OBJECTS) $(SPECTRAL_CONES_OBJECTS)
24
+ else
25
+ SCS_OBJECTS = $(BASE_SCS_OBJECTS)
26
+ endif
27
+ else
28
+ SCS_OBJECTS = $(BASE_SCS_OBJECTS)
29
+ endif
30
+
5
31
  SCS_O = src/scs.o
6
32
  SCS_INDIR_O = src/scs_indir.o
7
33
 
@@ -27,6 +53,12 @@ else
27
53
  @echo "NOT compiled with blas/lapack, cannot solve SDPs (can solve LPs, SOCPs, ECPs, and PCPs)."
28
54
  @echo "To solve SDPs, install blas and lapack, then edit scs.mk to set USE_LAPACK=1"
29
55
  @echo "and point to the library install locations, and recompile with 'make purge', 'make'."
56
+ endif
57
+ ifneq ($(USE_SPECTRAL_CONES), 0)
58
+ @echo "Compiled with spectral cones extension enabled (Daniel Cederberg 2025)"
59
+ else
60
+ @echo "Spectral cones extension is NOT enabled. To enable spectral cones, edit"
61
+ @echo "scs.mk to set USE_SPECTRAL_CONES=1 and recompile."
30
62
  endif
31
63
  @echo "****************************************************************************************"
32
64
 
@@ -51,6 +83,8 @@ src/scs_version.o: src/scs_version.c $(INC_FILES)
51
83
  $(DIRSRC)/private.o: $(DIRSRC)/private.c $(DIRSRC)/private.h
52
84
  $(INDIRSRC)/indirect/private.o: $(INDIRSRC)/private.c $(INDIRSRC)/private.h
53
85
  $(MKLSRC)/private.o: $(MKLSRC)/private.c $(MKLSRC)/private.h
86
+ $(CUDSSSRC)/private.o: $(CUDSSSRC)/private.c $(CUDSSSRC)/private.h
87
+ $(CUCC) $(INCLUDE) $(CUDSS_FLAGS) -I$(CUDSSSRC) -c $(CUDSSSRC)/private.c -o $@
54
88
  $(LINSYS)/scs_matrix.o: $(LINSYS)/scs_matrix.c $(LINSYS)/scs_matrix.h
55
89
  $(LINSYS)/csparse.o: $(LINSYS)/csparse.c $(LINSYS)/csparse.h
56
90
 
@@ -69,6 +103,11 @@ $(OUT)/libscsmkl.a: $(SCS_O) $(SCS_OBJECTS) $(MKLSRC)/private.o $(LINSYS)/scs_ma
69
103
  $(ARCHIVE) $@ $^
70
104
  - $(RANLIB) $@
71
105
 
106
+ $(OUT)/libscscudss.a: $(SCS_O) $(SCS_OBJECTS) $(CUDSSSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
107
+ mkdir -p $(OUT)
108
+ $(ARCHIVE) $@ $^
109
+ - $(RANLIB) $@
110
+
72
111
  $(OUT)/libscsdir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
73
112
  mkdir -p $(OUT)
74
113
  $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
@@ -81,6 +120,10 @@ $(OUT)/libscsmkl.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(MKLSRC)/private.o $(LINSYS
81
120
  mkdir -p $(OUT)
82
121
  $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(MKLFLAGS)
83
122
 
123
+ $(OUT)/libscscudss.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(CUDSSSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
124
+ mkdir -p $(OUT)
125
+ $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(CULDFLAGS)
126
+
84
127
  $(OUT)/demo_socp_direct: test/random_socp_prob.c $(OUT)/libscsdir.a
85
128
  $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
86
129
 
@@ -90,6 +133,9 @@ $(OUT)/demo_socp_indirect: test/random_socp_prob.c $(OUT)/libscsindir.a
90
133
  $(OUT)/demo_socp_mkl: test/random_socp_prob.c $(OUT)/libscsmkl.a
91
134
  $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MKLFLAGS)
92
135
 
136
+ $(OUT)/demo_socp_cudss: test/random_socp_prob.c $(OUT)/libscscudss.a
137
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CUDSS_LDFLAGS)
138
+
93
139
  $(OUT)/run_from_file_direct: test/run_from_file.c $(OUT)/libscsdir.a
94
140
  $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS)
95
141
 
@@ -109,6 +155,8 @@ $(OUT)/run_tests_direct: test/run_tests.c $(OUT)/libscsdir.a
109
155
  $(OUT)/run_tests_mkl: test/run_tests.c $(OUT)/libscsmkl.a
110
156
  $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(MKLFLAGS) -Itest
111
157
 
158
+ $(OUT)/run_tests_cudss: test/run_tests.c $(OUT)/libscscudss.a
159
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CUDSS_LDFLAGS) -Itest
112
160
 
113
161
  .PHONY: test_gpu
114
162
  test_gpu: $(OUT)/run_tests_gpu_indirect # $(OUT)/run_tests_gpu_direct
@@ -120,6 +168,8 @@ ifndef MKLROOT
120
168
  $(error MKLROOT is undefined, set MKLROOT to the MKL install location)
121
169
  endif
122
170
 
171
+ .PHONY:
172
+ cudss: $(OUT)/libscscudss.a $(OUT)/libscscudss.$(SHARED) $(OUT)/run_tests_cudss $(OUT)/demo_socp_cudss
123
173
 
124
174
  $(OUT)/run_tests_gpu_indirect: test/run_tests.c $(OUT)/libscsgpuindir.a
125
175
  $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(BLASLDFLAGS) $(CULDFLAGS) -Itest
@@ -134,13 +184,13 @@ gpu: gpu_indirect # gpu_direct
134
184
  gpu_indirect: $(OUT)/demo_socp_gpu_indirect $(OUT)/libscsgpuindir.$(SHARED) $(OUT)/libscsgpuindir.a $(OUT)/run_from_file_gpu_indirect
135
185
 
136
186
  $(LINSYS)/gpu/gpu.o: $(LINSYS)/gpu/gpu.c
137
- $(CUCC) -c -o $@ $^ $(CUDAFLAGS)
187
+ $(CC) -c -o $@ $^ $(CUDAFLAGS)
138
188
 
139
189
  # $(GPUDIR)/private.o: $(GPUDIR)/private.c
140
190
  # $(CUCC) -c -o $(GPUDIR)/private.o $^ $(CUDAFLAGS)
141
191
 
142
192
  $(GPUINDIR)/private.o: $(GPUINDIR)/private.c
143
- $(CUCC) -c -o $@ $^ $(CUDAFLAGS)
193
+ $(CC) -c -o $@ $^ $(CUDAFLAGS)
144
194
 
145
195
  # $(OUT)/libscsgpudir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
146
196
  # mkdir -p $(OUT)
data/vendor/scs/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
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.2.7`.
11
+ large-scale convex cone problems. The current version is `3.2.8`.
12
12
 
13
13
  The full documentation is available [here](https://www.cvxgrp.org/scs/).
14
14
 
@@ -11,6 +11,17 @@ extern "C" {
11
11
  #include "scs_work.h"
12
12
  #include <string.h>
13
13
 
14
+ #ifdef USE_SPECTRAL_CONES
15
+ #include "util_spectral_cones.h" // for newton_stats
16
+
17
+ // macro for time measurements of SpectralSCS
18
+ #ifdef SPECTRAL_TIMING_FLAG
19
+ #define SPECTRAL_TIMING(action) action
20
+ #else
21
+ #define SPECTRAL_TIMING(action)
22
+ #endif
23
+ #endif
24
+
14
25
  /* private data to help cone projection step */
15
26
  struct SCS_CONE_WORK {
16
27
  /*
@@ -26,10 +37,44 @@ struct SCS_CONE_WORK {
26
37
  scs_int m; /* total length of cone */
27
38
  /* box cone quantities */
28
39
  scs_float box_t_warm_start;
40
+
29
41
  #ifdef USE_LAPACK
30
42
  /* workspace for eigenvector decompositions: */
31
- scs_float *Xs, *Z, *e, *work;
32
- blas_int lwork;
43
+ scs_float *Xs, *Z, *e, *work, *rwork;
44
+ scs_complex_float *cXs, *cZ, *cwork;
45
+ blas_int *isuppz, *iwork;
46
+ blas_int lwork, lcwork, lrwork, liwork;
47
+ #endif
48
+
49
+ #ifdef USE_SPECTRAL_CONES
50
+ /* if the projection onto the logarithmic cone should be warmstarted*/
51
+ bool *log_cone_warmstarts;
52
+
53
+ /* Needed for ell1 norm cone projection */
54
+ Value_index *work_ell1;
55
+ scs_float *work_ell1_proj;
56
+
57
+ // used for timing spectral vector cone and spectral matrix cone projections
58
+ SPECTRAL_TIMING(scs_float tot_time_mat_cone_proj;)
59
+ SPECTRAL_TIMING(scs_float tot_time_vec_cone_proj;)
60
+
61
+ /* workspace for singular value decompositions: */
62
+ scs_float *s_nuc, *u_nuc, *vt_nuc, *work_nuc;
63
+ blas_int lwork_nuc;
64
+
65
+ /* workspace that is used internally in the logdet projection (for example,
66
+ the gradient and Hessian of the objective function in the projection
67
+ problem are stored using this memory) */
68
+ scs_float *work_logdet;
69
+
70
+ /* workspace to store the projection onto the logarithm cone */
71
+ scs_float *saved_log_projs;
72
+
73
+ /* Stats for spectral projections, assuming there is only one spectral cone */
74
+ Newton_stats newton_stats;
75
+
76
+ /* workspace for projection onto sum-largest-evals cone */
77
+ scs_float *work_sum_of_largest;
33
78
  #endif
34
79
  };
35
80
 
@@ -14,7 +14,7 @@ extern "C" {
14
14
 
15
15
  /* SCS VERSION NUMBER ---------------------------------------------- */
16
16
  /* string literals automatically null-terminated */
17
- #define SCS_VERSION ("3.2.7")
17
+ #define SCS_VERSION ("3.2.8")
18
18
 
19
19
  /* verbosity level */
20
20
  #ifndef VERBOSITY
@@ -130,6 +130,10 @@ typedef struct {
130
130
  scs_int *s;
131
131
  /** Length of semidefinite constraints array `s`. */
132
132
  scs_int ssize;
133
+ /** Array of complex semidefinite cone constraints, `len(cs) = cssize`. */
134
+ scs_int *cs;
135
+ /** Length of complex semidefinite constraints array `cs`. */
136
+ scs_int cssize;
133
137
  /** Number of primal exponential cone triples. */
134
138
  scs_int ep;
135
139
  /** Number of dual exponential cone triples. */
@@ -139,6 +143,24 @@ typedef struct {
139
143
  scs_float *p;
140
144
  /** Number of (primal and dual) power cone triples. */
141
145
  scs_int psize;
146
+ #ifdef USE_SPECTRAL_CONES
147
+ /** Array of logdet cone constraints 'len(d) = dsize'. The dimension of a
148
+ * log-det cone is "n" and not "n+2" if the matrix has dimension n */
149
+ scs_int *d;
150
+ /** Length of logdet cone constraints array `d`. */
151
+ scs_int dsize;
152
+ /** Array of nuc norm cone constraints 'len(nuc_m) = len(nuc_n) = nucsize.*/
153
+ scs_int *nuc_m;
154
+ scs_int *nuc_n;
155
+ scs_int nucsize;
156
+ /** Array of ell1-norm cone constraints 'len(ell1) = ell1_size */
157
+ scs_int *ell1;
158
+ scs_int ell1_size;
159
+ /** Array of sum-of-largest-evals cone */
160
+ scs_int *sl_n;
161
+ scs_int *sl_k;
162
+ scs_int sl_size;
163
+ #endif
142
164
  } ScsCone;
143
165
 
144
166
  /** Contains primal-dual solution arrays or a certificate of infeasibility.
@@ -202,6 +224,13 @@ typedef struct {
202
224
  scs_float cone_time;
203
225
  /** Total time (milliseconds) spent in the acceleration routine. */
204
226
  scs_float accel_time;
227
+ #ifdef SPECTRAL_TIMING_FLAG
228
+ /** Average time (milliseconds) per iteration matrix cone projection */
229
+ scs_float ave_time_matrix_cone_proj;
230
+ /** Average time (milliseconds) per iteration for spectral vector cone
231
+ * projection */
232
+ scs_float ave_time_vector_cone_proj;
233
+ #endif
205
234
  } ScsInfo;
206
235
 
207
236
  /*
@@ -18,9 +18,11 @@ extern "C" {
18
18
  #ifndef SFLOAT
19
19
  #define BLAS(x) d##x
20
20
  #define BLASI(x) id##x
21
+ #define BLASC(x) z##x
21
22
  #else
22
23
  #define BLAS(x) s##x
23
24
  #define BLASI(x) is##x
25
+ #define BLASC(x) c##x
24
26
  #endif
25
27
  #else
26
28
  /* this extra indirection is needed for BLASSUFFIX to work correctly as a
@@ -31,9 +33,11 @@ extern "C" {
31
33
  #ifndef SFLOAT
32
34
  #define BLAS(x) stitch__(d, x, BLASSUFFIX)
33
35
  #define BLASI(x) stitch__(id, x, BLASSUFFIX)
36
+ #define BLASC(x) stitch__(z, x, BLASSUFFIX)
34
37
  #else
35
38
  #define BLAS(x) stitch__(s, x, BLASSUFFIX)
36
39
  #define BLASI(x) stitch__(is, x, BLASSUFFIX)
40
+ #define BLASC(x) stitch__(c, x, BLASSUFFIX)
37
41
  #endif
38
42
  #endif
39
43
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Pulic header including definitions of primitive types used in SCS.
2
+ * Public header including definitions of primitive types used in SCS.
3
3
  * Make sure this file and `scs.h` are somewhere appropriate and then use
4
4
  * `#include "scs.h"` to access the SCS public API.
5
5
  */
@@ -26,8 +26,10 @@ typedef int scs_int;
26
26
 
27
27
  #ifndef SFLOAT
28
28
  typedef double scs_float;
29
+ typedef double scs_complex_float[2]; // [real, imaginary]
29
30
  #else
30
31
  typedef float scs_float;
32
+ typedef float scs_complex_float[2]; // [real, imaginary]
31
33
  #endif
32
34
 
33
35
  #ifdef __cplusplus
@@ -0,0 +1,45 @@
1
+ #ifndef UTILSPECTRALCONES_H
2
+ #define UTILSPECTRALCONES_H
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "scs_blas.h"
9
+ #include "scs_types.h"
10
+ #include <assert.h>
11
+ #include <math.h>
12
+ #include <stdbool.h>
13
+ #include <stddef.h>
14
+ #include <stdio.h>
15
+
16
+ #define IN_CONE -1
17
+ #define IN_NEGATIVE_DUAL_CONE -2
18
+ #define ANALYTICAL_SOL -3
19
+
20
+ bool is_pos(const scs_float *x, scs_int n);
21
+ bool is_negative(const scs_float *x, scs_int n);
22
+ void non_neg_proj(const scs_float *src, scs_float *dst, scs_int n);
23
+ scs_float sum_log(const scs_float *x, scs_int n);
24
+ scs_float min_vec(const scs_float *vec, scs_int n);
25
+
26
+ // used for sorting in ell1-norm cone and sum of largest cone.
27
+ typedef struct {
28
+ scs_float value;
29
+ int index;
30
+ } Value_index;
31
+
32
+ typedef struct {
33
+ int iter;
34
+
35
+ // if plain Newton computed the projection or if an IPM was used
36
+ int newton_success;
37
+
38
+ // dual_res, pri_res, complementarity for the projection problem
39
+ scs_float residuals[3];
40
+ } Newton_stats;
41
+
42
+ #ifdef __cplusplus
43
+ }
44
+ #endif
45
+ #endif
@@ -51,7 +51,7 @@ static scs_int ldl_prepare(ScsLinSysWork *p) {
51
51
  L->i = (scs_int *)scs_calloc(nzmax, sizeof(scs_int));
52
52
  p->Dinv = (scs_float *)scs_calloc(n, sizeof(scs_float));
53
53
  p->D = (scs_float *)scs_calloc(n, sizeof(scs_float));
54
- p->bwork = (scs_int *)scs_calloc(n, sizeof(scs_int));
54
+ p->bwork = (QDLDL_bool *)scs_calloc(n, sizeof(QDLDL_bool));
55
55
  p->fwork = (scs_float *)scs_calloc(n, sizeof(scs_float));
56
56
  return nzmax;
57
57
  }
@@ -143,7 +143,7 @@ static ScsMatrix *cs_symperm(const ScsMatrix *A, const scs_int *pinv,
143
143
  i = Ai[p];
144
144
  if (i > j) {
145
145
  continue;
146
- } /* skip lower triangular part of A */
146
+ } /* skip lower triangular part of A */
147
147
  i2 = pinv ? pinv[i] : i; /* row i of A is row i2 of C */
148
148
  w[MAX(i2, j2)]++; /* column count of C */
149
149
  }
@@ -155,7 +155,7 @@ static ScsMatrix *cs_symperm(const ScsMatrix *A, const scs_int *pinv,
155
155
  i = Ai[p];
156
156
  if (i > j) {
157
157
  continue;
158
- } /* skip lower triangular part of A*/
158
+ } /* skip lower triangular part of A*/
159
159
  i2 = pinv ? pinv[i] : i; /* row i of A is row i2 of C */
160
160
  Ci[q = w[MAX(i2, j2)]++] = MIN(i2, j2);
161
161
  if (Cx) {
@@ -22,7 +22,8 @@ struct SCS_LIN_SYS_WORK {
22
22
  scs_int factorizations;
23
23
  /* ldl factorization workspace */
24
24
  scs_float *D, *fwork;
25
- scs_int *etree, *iwork, *Lnz, *bwork;
25
+ scs_int *etree, *iwork, *Lnz;
26
+ QDLDL_bool *bwork;
26
27
  scs_float *diag_p;
27
28
  };
28
29
 
@@ -7,7 +7,7 @@ ScsMatrix *SCS(cs_spalloc)(scs_int m, scs_int n, scs_int nzmax, scs_int values,
7
7
  ScsMatrix *A = (ScsMatrix *)scs_calloc(1, sizeof(ScsMatrix));
8
8
  if (!A) {
9
9
  return SCS_NULL;
10
- } /* out of memory */
10
+ } /* out of memory */
11
11
  A->m = m; /* define dimensions and nzmax */
12
12
  A->n = n;
13
13
  A->p = (scs_int *)scs_calloc((triplet ? nzmax : n + 1), sizeof(scs_int));