scs 0.3.1 → 0.3.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +8 -8
  4. data/lib/scs/ffi.rb +1 -7
  5. data/lib/scs/version.rb +1 -1
  6. data/vendor/scs/CITATION.cff +1 -1
  7. data/vendor/scs/CMakeLists.txt +55 -7
  8. data/vendor/scs/Makefile +9 -9
  9. data/vendor/scs/README.md +2 -1
  10. data/vendor/scs/include/aa.h +1 -1
  11. data/vendor/scs/include/cones.h +14 -11
  12. data/vendor/scs/include/glbopts.h +26 -64
  13. data/vendor/scs/include/linalg.h +2 -1
  14. data/vendor/scs/include/linsys.h +13 -13
  15. data/vendor/scs/include/normalize.h +6 -5
  16. data/vendor/scs/include/scs.h +43 -87
  17. data/vendor/scs/include/scs_types.h +34 -0
  18. data/vendor/scs/include/scs_work.h +83 -0
  19. data/vendor/scs/linsys/cpu/direct/private.c +86 -73
  20. data/vendor/scs/linsys/cpu/direct/private.h +2 -2
  21. data/vendor/scs/linsys/cpu/indirect/private.c +42 -33
  22. data/vendor/scs/linsys/cpu/indirect/private.h +1 -2
  23. data/vendor/scs/linsys/csparse.c +3 -3
  24. data/vendor/scs/linsys/external/amd/SuiteSparse_config.c +6 -6
  25. data/vendor/scs/linsys/external/amd/SuiteSparse_config.h +6 -1
  26. data/vendor/scs/linsys/external/amd/amd_order.c +5 -5
  27. data/vendor/scs/linsys/gpu/gpu.h +8 -11
  28. data/vendor/scs/linsys/gpu/indirect/private.c +72 -49
  29. data/vendor/scs/linsys/gpu/indirect/private.h +14 -13
  30. data/vendor/scs/linsys/scs_matrix.c +26 -46
  31. data/vendor/scs/linsys/scs_matrix.h +4 -4
  32. data/vendor/scs/scs.mk +1 -1
  33. data/vendor/scs/src/aa.c +13 -4
  34. data/vendor/scs/src/cones.c +143 -92
  35. data/vendor/scs/src/linalg.c +25 -0
  36. data/vendor/scs/src/normalize.c +26 -26
  37. data/vendor/scs/src/rw.c +48 -12
  38. data/vendor/scs/src/scs.c +104 -110
  39. data/vendor/scs/src/scs_version.c +8 -6
  40. data/vendor/scs/src/util.c +1 -1
  41. data/vendor/scs/test/minunit.h +6 -1
  42. data/vendor/scs/test/problem_utils.h +28 -35
  43. data/vendor/scs/test/problems/degenerate.h +1 -1
  44. data/vendor/scs/test/problems/hs21_tiny_qp.h +1 -1
  45. data/vendor/scs/test/problems/hs21_tiny_qp_rw.h +1 -1
  46. data/vendor/scs/test/problems/infeasible_tiny_qp.h +1 -1
  47. data/vendor/scs/test/problems/qafiro_tiny_qp.h +3 -3
  48. data/vendor/scs/test/problems/random_prob.h +1 -1
  49. data/vendor/scs/test/problems/rob_gauss_cov_est.h +1 -1
  50. data/vendor/scs/test/problems/small_lp.h +3 -1
  51. data/vendor/scs/test/problems/small_qp.h +352 -0
  52. data/vendor/scs/test/problems/{test_fails.h → test_validation.h} +3 -3
  53. data/vendor/scs/test/problems/unbounded_tiny_qp.h +1 -1
  54. data/vendor/scs/test/random_socp_prob.c +1 -1
  55. data/vendor/scs/test/run_from_file.c +1 -1
  56. data/vendor/scs/test/run_tests.c +23 -14
  57. metadata +8 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e9285e6e364ac8096c960ae6a00f5b62c6c4790bbd8ca067af9ca35c3652385
4
- data.tar.gz: 457069e09fe911cb688fcdd8c251dfc3282de4700aa04aadf8d1873528c8efea
3
+ metadata.gz: db74c6ffd6696e799a18d2f5d02f5b753020a2535e539cdd26abac388f1ea046
4
+ data.tar.gz: f7d5b3b98b58d812fb923193303b7f0bfcf7cb2972de2ae34a392fb9f4a5bd40
5
5
  SHA512:
6
- metadata.gz: af56c89f3a6cd61f89967da3521e79fab543b66bd57d66df42800b3bbcd600ed8acd8d3390e31d4dbc94d15e55d31743685622388029fa9be6906c6a041945c8
7
- data.tar.gz: e888d39ba02de61ae2fb4f166502de4442743608bea769d8fd01b9f08537ddb3ca6ac2790a49a73ed3900a983419c899ea28cf7a35a544b610a46ac68408fd38
6
+ metadata.gz: cf7a4948ba7a21865142a421da3e683904951faf7e602d429722cf05bdbae559dcc15484e6cb4afa6bf683ecf681757370bfa3fa7b01dab6620b300462eea703
7
+ data.tar.gz: 493da1d4fbe2fdb7180fffad3599137500d437b082d788365bf828dd8845469b3bf0d63863ea467c013cc2f874c5b04ab935c7129d45b1c890278dda7ad21039
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.2 (2022-01-17)
2
+
3
+ - Updated SCS to 3.1.1
4
+
1
5
  ## 0.3.1 (2021-10-08)
2
6
 
3
7
  - Fixed installation on Linux
data/README.md CHANGED
@@ -1,17 +1,17 @@
1
- # SCS
1
+ # SCS Ruby
2
2
 
3
3
  [SCS](https://github.com/cvxgrp/scs) - the splitting conic solver - for Ruby
4
4
 
5
5
  :fire: Supports many different [problem types](https://www.cvxpy.org/tutorial/advanced/index.html#choosing-a-solver)
6
6
 
7
- [![Build Status](https://github.com/ankane/scs/workflows/build/badge.svg?branch=master)](https://github.com/ankane/scs/actions)
7
+ [![Build Status](https://github.com/ankane/scs-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/scs-ruby/actions)
8
8
 
9
9
  ## Installation
10
10
 
11
11
  Add this line to your application’s Gemfile:
12
12
 
13
13
  ```ruby
14
- gem 'scs'
14
+ gem "scs"
15
15
  ```
16
16
 
17
17
  If installation fails, you may need to install [dependencies](#dependencies).
@@ -81,22 +81,22 @@ On Heroku, use the [heroku-apt-buildpack](https://github.com/heroku/heroku-build
81
81
 
82
82
  ## History
83
83
 
84
- View the [changelog](https://github.com/ankane/scs/blob/master/CHANGELOG.md)
84
+ View the [changelog](https://github.com/ankane/scs-ruby/blob/master/CHANGELOG.md)
85
85
 
86
86
  ## Contributing
87
87
 
88
88
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
89
89
 
90
- - [Report bugs](https://github.com/ankane/scs/issues)
91
- - Fix bugs and [submit pull requests](https://github.com/ankane/scs/pulls)
90
+ - [Report bugs](https://github.com/ankane/scs-ruby/issues)
91
+ - Fix bugs and [submit pull requests](https://github.com/ankane/scs-ruby/pulls)
92
92
  - Write, clarify, or fix documentation
93
93
  - Suggest or add new features
94
94
 
95
95
  To get started with development:
96
96
 
97
97
  ```sh
98
- git clone --recursive https://github.com/ankane/scs.git
99
- cd scs
98
+ git clone --recursive https://github.com/ankane/scs-ruby.git
99
+ cd scs-ruby
100
100
  bundle install
101
101
  bundle exec rake compile
102
102
  bundle exec rake test
data/lib/scs/ffi.rb CHANGED
@@ -27,13 +27,6 @@ module SCS
27
27
 
28
28
  dlload File.expand_path("../../vendor/scs/out/#{lib_name}.#{ext}", __dir__)
29
29
 
30
- extern "size_t scs_sizeof_int(void)"
31
- extern "size_t scs_sizeof_float(void)"
32
-
33
- # TODO support other sizes
34
- raise Error, "Unsupported int size" if scs_sizeof_int != 4
35
- raise Error, "Unsupported float size" if scs_sizeof_float != 8
36
-
37
30
  typealias "scs_float", "double"
38
31
  typealias "scs_int", "int"
39
32
 
@@ -71,6 +64,7 @@ module SCS
71
64
  m::Info = struct [
72
65
  "scs_int iter",
73
66
  "char status[128]",
67
+ "char lin_sys_solver[128]",
74
68
  "scs_int status_val",
75
69
  "scs_int scale_updates",
76
70
  "scs_float pobj",
data/lib/scs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SCS
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -10,7 +10,7 @@ authors:
10
10
  - family-names: "Boyd"
11
11
  given-names: "Stephen"
12
12
  title: "SCS: Spltting Conic Solver"
13
- version: 3.0.0
13
+ version: 3.1.1
14
14
  date-released: 2021
15
15
  url: "https://github.com/cvxgrp/scs"
16
16
 
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5)
5
5
 
6
6
  project(scs
7
7
  LANGUAGES C
8
- VERSION 2.1.4)
8
+ VERSION 3.1.1)
9
9
 
10
10
  # Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros.
11
11
  # See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
@@ -88,6 +88,10 @@ if(BUILD_TESTING)
88
88
  enable_testing()
89
89
  endif()
90
90
 
91
+ # Add uninstall target
92
+ # After 'make install' can run 'make uninstall' to remove.
93
+ include(AddUninstallTarget)
94
+
91
95
  ### Some variables useful for sampling the building process
92
96
  # Note that the GPU profile is not compiled.
93
97
  set(LINSYS linsys)
@@ -95,6 +99,46 @@ set(DIRSRC ${LINSYS}/cpu/direct)
95
99
  set(INDIRSRC ${LINSYS}/cpu/indirect)
96
100
  set(EXTERNAL ${LINSYS}/external)
97
101
 
102
+ # Options
103
+ # ----------------------------------------------
104
+ # Use floats instead of doubles
105
+ option(SFLOAT "Use single precision floats rather than doubles" OFF)
106
+ message(STATUS "Single precision floats (32bit) are ${SFLOAT}")
107
+
108
+ # Use long integers for indexing
109
+ option(DLONG "Use long integers (64bit) for indexing" OFF)
110
+ message(STATUS "Long integers (64bit) are ${DLONG}")
111
+
112
+
113
+ set(COMPILER_OPTS "-DUSE_LAPACK -DCOPYAMATRIX -DCTRLC")
114
+
115
+ # Primitive types
116
+ if(SFLOAT)
117
+ set(SCS_FLOAT_TYPE "float")
118
+ set(COMPILER_OPTS "-DSFLOAT ${COMPILER_OPTS}")
119
+ else()
120
+ set(SCS_FLOAT_TYPE "double")
121
+ endif()
122
+
123
+ if(DLONG)
124
+ set(SCS_INT_TYPE "long long")
125
+ set(COMPILER_OPTS "-DDLONG ${COMPILER_OPTS}")
126
+ else()
127
+ set(SCS_INT_TYPE "int")
128
+ endif()
129
+
130
+ message(STATUS "COMPILER_OPTS = ${COMPILER_OPTS}")
131
+
132
+ # TODO this is a hack that overwrites the scs_types.h file, we should
133
+ # find a way to do this that doesn't pollute the master directory.
134
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/scs_types.h.in
135
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/scs_types.h
136
+ NEWLINE_STYLE LF)
137
+
138
+ # Public headers
139
+ set(${PROJECT_NAME}_PUBLIC_HDR
140
+ include/scs_types.h
141
+ include/scs.h)
98
142
 
99
143
  # Common source files
100
144
  set(${PROJECT_NAME}_SRC
@@ -122,6 +166,8 @@ set(${PROJECT_NAME}_HDR
122
166
  include/rw.h
123
167
  include/scs.h
124
168
  include/scs_blas.h
169
+ include/scs_types.h
170
+ include/scs_work.h
125
171
  include/util.h
126
172
  ${LINSYS}/csparse.h
127
173
  ${LINSYS}/scs_matrix.h)
@@ -162,7 +208,7 @@ target_include_directories(${${PROJECT_NAME}_DIRECT} PUBLIC
162
208
  "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
163
209
 
164
210
  # Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
165
- target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE -DUSE_LAPACK -DCOPYAMATRIX -DCTRLC)
211
+ target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE ${COMPILER_OPTS})
166
212
 
167
213
  # The library depends on math (m) blas and lapack
168
214
  target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE
@@ -173,7 +219,7 @@ target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE
173
219
  # Set some properties
174
220
  set_target_properties(${${PROJECT_NAME}_DIRECT} PROPERTIES
175
221
  VERSION ${scs_VERSION}
176
- PUBLIC_HEADER "${${PROJECT_NAME}_HDR}")
222
+ PUBLIC_HEADER "${${PROJECT_NAME}_PUBLIC_HDR}")
177
223
 
178
224
  add_library(scs::${${PROJECT_NAME}_DIRECT} ALIAS ${${PROJECT_NAME}_DIRECT})
179
225
 
@@ -209,7 +255,7 @@ target_include_directories(${${PROJECT_NAME}_INDIRECT} PUBLIC
209
255
  "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
210
256
 
211
257
  # Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
212
- target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE -DUSE_LAPACK -DCOPYAMATRIX -DCTRLC -DINDIRECT)
258
+ target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE ${COMPILER_OPTS} -DINDIRECT)
213
259
 
214
260
  # The library depends on math (m) blas and lapack
215
261
  target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC
@@ -220,7 +266,7 @@ target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC
220
266
  # Set some properties
221
267
  set_target_properties(${${PROJECT_NAME}_INDIRECT} PROPERTIES
222
268
  VERSION ${scs_VERSION}
223
- PUBLIC_HEADER "${${${PROJECT_NAME}_INDIRECT}_HDR}")
269
+ PUBLIC_HEADER "${${PROJECT_NAME}_PUBLIC_HDR}")
224
270
 
225
271
  add_library(scs::${${PROJECT_NAME}_INDIRECT} ALIAS ${${PROJECT_NAME}_INDIRECT})
226
272
 
@@ -250,20 +296,22 @@ install_basic_package_files(${PROJECT_NAME}
250
296
  ### Add the tests
251
297
  if(BUILD_TESTING)
252
298
  add_executable(run_tests_direct test/run_tests.c)
299
+ target_compile_definitions(run_tests_direct PRIVATE ${COMPILER_OPTS})
253
300
  target_link_libraries(run_tests_direct PRIVATE
254
301
  scs::scsdir)
255
302
  target_include_directories(run_tests_direct PRIVATE
256
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test;${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>")
303
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test;${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>" )
257
304
 
258
305
  add_test(NAME run_tests_direct
259
306
  COMMAND run_tests_direct
260
307
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
261
308
 
262
309
  add_executable(run_tests_indirect test/run_tests.c)
310
+ target_compile_definitions(run_tests_indirect PRIVATE ${COMPILER_OPTS})
263
311
  target_link_libraries(run_tests_indirect PRIVATE
264
312
  scs::scsindir)
265
313
  target_include_directories(run_tests_indirect PRIVATE
266
- "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test;${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>")
314
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/test;${CMAKE_CURRENT_SOURCE_DIR}/include;${CMAKE_CURRENT_SOURCE_DIR}/${LINSYS}>" )
267
315
 
268
316
  add_test(NAME run_tests_indirect
269
317
  COMMAND run_tests_indirect
data/vendor/scs/Makefile CHANGED
@@ -39,13 +39,13 @@ $(SCS_INDIR_O): src/scs.c $(INC_FILES)
39
39
  %.o : src/%.c
40
40
  $(CC) $(CFLAGS) -c $< -o $@
41
41
 
42
- src/util.o : src/util.c include/util.h include/glbopts.h
43
- src/cones.o : src/cones.c include/cones.h include/scs_blas.h
44
- src/aa.o : src/aa.c include/aa.h include/scs_blas.h
45
- src/rw.o : src/rw.c include/rw.h
46
- src/linalg.o: src/linalg.c include/linalg.h
47
- src/ctrl.o : src/ctrl.c include/ctrl.h
48
- src/scs_version.o: src/scs_version.c include/glbopts.h
42
+ src/util.o : src/util.c $(INC_FILES)
43
+ src/cones.o : src/cones.c $(INC_FILES)
44
+ src/aa.o : src/aa.c $(INC_FILES)
45
+ src/rw.o : src/rw.c $(INC_FILES)
46
+ src/linalg.o: src/linalg.c $(INC_FILES)
47
+ src/ctrl.o : src/ctrl.c $(INC_FILES)
48
+ src/scs_version.o: src/scs_version.c $(INC_FILES)
49
49
 
50
50
  $(DIRSRC)/private.o: $(DIRSRC)/private.c $(DIRSRC)/private.h
51
51
  $(INDIRSRC)/indirect/private.o: $(INDIRSRC)/private.c $(INDIRSRC)/private.h
@@ -115,7 +115,7 @@ $(LINSYS)/gpu/gpu.o: $(LINSYS)/gpu/gpu.c
115
115
  # $(CUCC) -c -o $(GPUDIR)/private.o $^ $(CUDAFLAGS)
116
116
 
117
117
  $(GPUINDIR)/private.o: $(GPUINDIR)/private.c
118
- $(CUCC) -c -o $(GPUINDIR)/private.o $^ $(CUDAFLAGS)
118
+ $(CUCC) -c -o $@ $^ $(CUDAFLAGS)
119
119
 
120
120
  # $(OUT)/libscsgpudir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
121
121
  # mkdir -p $(OUT)
@@ -143,7 +143,7 @@ $(OUT)/demo_socp_gpu_indirect: test/random_socp_prob.c $(OUT)/libscsgpuindir.a
143
143
 
144
144
  .PHONY: clean purge
145
145
  clean:
146
- @rm -rf $(TARGETS) $(SCS_O) $(SCS_INDIR_O) $(SCS_OBJECTS) $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/*.o $(DIRSRC)/*.o $(INDIRSRC)/*.o $(GPUDIR)/*.o $(GPUINDIR)/*.o
146
+ @rm -rf $(TARGETS) $(SCS_O) $(SCS_INDIR_O) $(SCS_OBJECTS) $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/*.o $(DIRSRC)/*.o $(INDIRSRC)/*.o $(GPUDIR)/*.o $(GPUINDIR)/*.o $(LINSYS)/gpu/*.o
147
147
  @rm -rf $(OUT)/*.dSYM
148
148
  @rm -rf matlab/*.mex*
149
149
  @rm -rf .idea
data/vendor/scs/README.md CHANGED
@@ -3,10 +3,11 @@
3
3
  </h1>
4
4
 
5
5
  [![Build Status](https://github.com/cvxgrp/scs/actions/workflows/build.yml/badge.svg)](https://github.com/cvxgrp/scs/actions/workflows/build.yml)
6
+ [![Documentation](https://img.shields.io/badge/docs-online-brightgreen?logo=read-the-docs&style=flat)](https://www.cvxgrp.org/scs/)
6
7
  [![Coverage Status](https://coveralls.io/repos/github/cvxgrp/scs/badge.svg?branch=master)](https://coveralls.io/github/cvxgrp/scs?branch=master)
7
8
 
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.0.0`.
11
+ large-scale convex cone problems. The current version is `3.1.1`.
11
12
 
12
13
  The full documentation is available [here](https://www.cvxgrp.org/scs/).
@@ -23,7 +23,7 @@ typedef struct ACCEL_WORK AaWork;
23
23
  * @param type1 if True use type 1 AA, otherwise use type 2
24
24
  * @param regularization type-I and type-II different, for type-I: 1e-8 works
25
25
  * well, type-II: more stable can use 1e-12 often
26
- * @param relaxation float \in [0,2], mixing parameter (1.0 is vanilla)
26
+ * @param relaxation float in [0,2], mixing parameter (1.0 is vanilla)
27
27
  * @param safeguard_factor factor that controls safeguarding checks
28
28
  * larger is more aggressive but less stable
29
29
  * @param max_weight_norm float, maximum norm of AA weights
@@ -8,6 +8,8 @@ extern "C" {
8
8
  #include "glbopts.h"
9
9
  #include "scs.h"
10
10
  #include "scs_blas.h"
11
+ #include "scs_work.h"
12
+ #include <string.h>
11
13
 
12
14
  /* private data to help cone projection step */
13
15
  struct SCS_CONE_WORK {
@@ -16,8 +18,12 @@ struct SCS_CONE_WORK {
16
18
  * cone boundaries, boundaries[0] is starting index for cones of size larger
17
19
  * than 1
18
20
  */
19
- scs_float *s; /* used for Moreau decomposition in projection */
20
- scs_int cone_len;
21
+ const ScsCone *k; /* original cone information */
22
+ scs_int *cone_boundaries;
23
+ scs_int cone_boundaries_len;
24
+ scs_int scaled_cones; /* boolean, whether the cones have been scaled */
25
+ scs_float *s; /* used for Moreau decomposition in projection */
26
+ scs_int m; /* total length of cone */
21
27
  /* box cone quantities */
22
28
  scs_float *bl, *bu, box_t_warm_start;
23
29
  #ifdef USE_LAPACK
@@ -27,18 +33,15 @@ struct SCS_CONE_WORK {
27
33
  #endif
28
34
  };
29
35
 
30
- ScsConeWork *SCS(init_cone)(const ScsCone *k, const ScsScaling *scal,
31
- scs_int cone_len);
36
+ ScsConeWork *SCS(init_cone)(const ScsCone *k, scs_int m);
32
37
  char *SCS(get_cone_header)(const ScsCone *k);
33
38
  scs_int SCS(validate_cones)(const ScsData *d, const ScsCone *k);
34
- scs_int SCS(set_cone_boundaries)(const ScsCone *k, scs_int **cone_boundaries);
35
-
36
- scs_int SCS(proj_dual_cone)(scs_float *x, const ScsCone *k, ScsConeWork *c,
37
- scs_int normalize);
39
+ scs_int SCS(proj_dual_cone)(scs_float *x, ScsConeWork *c, ScsScaling *scal,
40
+ scs_float *r_y);
38
41
  void SCS(finish_cone)(ScsConeWork *c);
39
-
40
- void SCS(set_rho_y_vec)(const ScsCone *k, scs_float scale, scs_float *rho_y_vec,
41
- scs_int m);
42
+ void SCS(set_r_y)(const ScsConeWork *c, scs_float scale, scs_float *r_y);
43
+ void SCS(enforce_cone_boundaries)(const ScsConeWork *c, scs_float *vec,
44
+ scs_float (*f)(const scs_float *, scs_int));
42
45
 
43
46
  #ifdef __cplusplus
44
47
  }
@@ -5,27 +5,16 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
+ #include "scs.h"
8
9
  #include <math.h>
9
10
 
10
11
  #ifndef SCS
11
- #define SCS(x) scs_##x
12
+ #define SCS(x) _scs_##x
12
13
  #endif
13
14
 
14
15
  /* SCS VERSION NUMBER ---------------------------------------------- */
15
- #define SCS_VERSION \
16
- ("3.0.0") /* string literals automatically null-terminated */
17
-
18
- /* SCS returns one of the following integers: */
19
- #define SCS_INFEASIBLE_INACCURATE (-7)
20
- #define SCS_UNBOUNDED_INACCURATE (-6)
21
- #define SCS_SIGINT (-5)
22
- #define SCS_FAILED (-4)
23
- #define SCS_INDETERMINATE (-3)
24
- #define SCS_INFEASIBLE (-2) /* primal infeasible, dual unbounded */
25
- #define SCS_UNBOUNDED (-1) /* primal unbounded, dual infeasible */
26
- #define SCS_UNFINISHED (0) /* never returned, used as placeholder */
27
- #define SCS_SOLVED (1)
28
- #define SCS_SOLVED_INACCURATE (2)
16
+ /* string literals automatically null-terminated */
17
+ #define SCS_VERSION ("3.1.1")
29
18
 
30
19
  /* verbosity level */
31
20
  #ifndef VERBOSITY
@@ -54,10 +43,10 @@ extern "C" {
54
43
  #ifdef MATLAB_MEX_FILE
55
44
  #include "mex.h"
56
45
  #define scs_printf mexPrintf
57
- #define _scs_free mxFree
58
- #define _scs_malloc mxMalloc
59
- #define _scs_calloc mxCalloc
60
- #define _scs_realloc mxRealloc
46
+ #define scs_free mxFree
47
+ #define scs_malloc mxMalloc
48
+ #define scs_calloc mxCalloc
49
+ #define scs_realloc mxRealloc
61
50
  #elif defined PYTHON
62
51
  #include <Python.h>
63
52
  #define scs_printf(...) \
@@ -66,18 +55,18 @@ extern "C" {
66
55
  PySys_WriteStdout(__VA_ARGS__); \
67
56
  PyGILState_Release(gilstate); \
68
57
  }
69
- /* only for SuiteSparse */
70
- #define _scs_printf PySys_WriteStdout
71
58
  #if PY_MAJOR_VERSION >= 3
72
- #define _scs_free PyMem_RawFree
73
- #define _scs_malloc PyMem_RawMalloc
74
- #define _scs_realloc PyMem_RawRealloc
75
- #define _scs_calloc PyMem_RawCalloc
59
+ #define scs_free PyMem_RawFree
60
+ #define scs_malloc PyMem_RawMalloc
61
+ #define scs_realloc PyMem_RawRealloc
62
+ #define scs_calloc PyMem_RawCalloc
63
+ /* only for SuiteSparse + python */
64
+ #define _scs_printf PySys_WriteStdout
76
65
  #else
77
- #define _scs_free PyMem_Free
78
- #define _scs_malloc PyMem_Malloc
79
- #define _scs_realloc PyMem_Realloc
80
- static inline void *_scs_calloc(size_t count, size_t size) {
66
+ #define scs_free PyMem_Free
67
+ #define scs_malloc PyMem_Malloc
68
+ #define scs_realloc PyMem_Realloc
69
+ static inline void *scs_calloc(size_t count, size_t size) {
81
70
  void *obj = PyMem_Malloc(count * size);
82
71
  memset(obj, 0, count * size);
83
72
  return obj;
@@ -88,47 +77,21 @@ static inline void *_scs_calloc(size_t count, size_t size) {
88
77
  #include <stdio.h>
89
78
  #include <stdlib.h>
90
79
  #define scs_printf Rprintf
91
- #define _scs_free free
92
- #define _scs_malloc malloc
93
- #define _scs_calloc calloc
94
- #define _scs_realloc realloc
80
+ #define scs_free free
81
+ #define scs_malloc malloc
82
+ #define scs_calloc calloc
83
+ #define scs_realloc realloc
95
84
  #else
96
85
  #include <stdio.h>
97
86
  #include <stdlib.h>
98
87
  #define scs_printf printf
99
- #define _scs_free free
100
- #define _scs_malloc malloc
101
- #define _scs_calloc calloc
102
- #define _scs_realloc realloc
103
- #endif
104
-
105
- /* Only required for SuiteSparse compatibility: */
106
- #ifndef _scs_printf
107
- #define _scs_printf scs_printf
108
- #endif
109
-
110
- #define scs_free(x) \
111
- _scs_free(x); \
112
- x = SCS_NULL
113
- #define scs_malloc(x) _scs_malloc(x)
114
- #define scs_calloc(x, y) _scs_calloc(x, y)
115
- #define scs_realloc(x, y) _scs_realloc(x, y)
116
-
117
- #ifdef DLONG
118
- /*#ifdef _WIN64
119
- #include <stdint.h>
120
- typedef int64_t scs_int;
121
- #else
122
- typedef long scs_int;
123
- #endif
124
- */
125
- typedef long long scs_int;
126
- #else
127
- typedef int scs_int;
88
+ #define scs_free free
89
+ #define scs_malloc malloc
90
+ #define scs_calloc calloc
91
+ #define scs_realloc realloc
128
92
  #endif
129
93
 
130
94
  #ifndef SFLOAT
131
- typedef double scs_float;
132
95
  #ifndef NAN
133
96
  #define NAN ((scs_float)0x7ff8000000000000)
134
97
  #endif
@@ -136,7 +99,6 @@ typedef double scs_float;
136
99
  #define INFINITY NAN
137
100
  #endif
138
101
  #else
139
- typedef float scs_float;
140
102
  #ifndef NAN
141
103
  #define NAN ((float)0x7fc00000)
142
104
  #endif
@@ -5,7 +5,7 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
- #include "scs.h"
8
+ #include "glbopts.h"
9
9
  #include <math.h>
10
10
 
11
11
  void SCS(scale_array)(scs_float *a, const scs_float b, scs_int len);
@@ -17,6 +17,7 @@ void SCS(add_scaled_array)(scs_float *a, const scs_float *b, scs_int n,
17
17
  const scs_float sc);
18
18
  scs_float SCS(norm_diff)(const scs_float *a, const scs_float *b, scs_int l);
19
19
  scs_float SCS(norm_inf_diff)(const scs_float *a, const scs_float *b, scs_int l);
20
+ scs_float SCS(mean)(const scs_float *x, scs_int l);
20
21
 
21
22
  #ifdef __cplusplus
22
23
  }
@@ -5,6 +5,7 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
+ #include "glbopts.h"
8
9
  #include "scs.h"
9
10
 
10
11
  /* This is the API that any new linear system solver must implement */
@@ -16,15 +17,14 @@ extern "C" {
16
17
  /**
17
18
  * Initialize `ScsLinSysWork` structure and perform any necessary preprocessing.
18
19
  *
19
- * @param A A data matrix.
20
- * @param P P data matrix.
21
- * @param rho_y_vec `rho_y > 0` diagonal entries.
22
- * @param rho_x `rho_x > 0` float.
20
+ * @param A `A` data matrix, `m x n`.
21
+ * @param P `P` data matrix, `n x n`.
22
+ * @param diag_r `R > 0` diagonal entries of length `m + n`.
23
23
  * @return Linear system solver workspace.
24
24
  *
25
25
  */
26
26
  ScsLinSysWork *SCS(init_lin_sys_work)(const ScsMatrix *A, const ScsMatrix *P,
27
- scs_float *rho_y_vec, scs_float rho_x);
27
+ const scs_float *diag_r);
28
28
 
29
29
  /**
30
30
  * Frees `ScsLinSysWork` structure and associated allocated memory.
@@ -34,15 +34,15 @@ ScsLinSysWork *SCS(init_lin_sys_work)(const ScsMatrix *A, const ScsMatrix *P,
34
34
  void SCS(free_lin_sys_work)(ScsLinSysWork *w);
35
35
 
36
36
  /**
37
- * Solves the linear system required by SCS at each iteration:
37
+ * Solves the linear system as required by SCS at each iteration:
38
38
  * \f[
39
39
  * \begin{bmatrix}
40
- * (\rho_x I + P) & A^\top \\
41
- * A & -\mathrm{diag}(\rho_y) \\
40
+ * (R_x + P) & A^\top \\
41
+ * A & -R_y \\
42
42
  * \end{bmatrix} x = b
43
43
  * \f]
44
44
  *
45
- * for `x`. Overwrites `b` with result.
45
+ * for `x`, where `diag(R_x, R_y) = R`. Overwrites `b` with result.
46
46
  *
47
47
  * @param w Linear system private workspace.
48
48
  * @param b Right hand side, contains solution at the end.
@@ -54,15 +54,15 @@ void SCS(free_lin_sys_work)(ScsLinSysWork *w);
54
54
  scs_int SCS(solve_lin_sys)(ScsLinSysWork *w, scs_float *b, const scs_float *s,
55
55
  scs_float tol);
56
56
  /**
57
- * Update the linsys workspace when `rho_y_vec` is changed. For example, a
57
+ * Update the linsys workspace when `R` is changed. For example, a
58
58
  * direct method for solving the linear system might need to update the
59
59
  * factorization of the matrix.
60
60
  *
61
- * @param w Linear system private workspace.
62
- * @param rho_y_vec `rho_y` diagonal entries.
61
+ * @param w Linear system private workspace.
62
+ * @param new_diag_r Updated `diag_r`, diagonal entries of R.
63
63
  *
64
64
  */
65
- void SCS(update_lin_sys_rho_y_vec)(ScsLinSysWork *w, scs_float *rho_y_vec);
65
+ void SCS(update_lin_sys_diag_r)(ScsLinSysWork *w, const scs_float *new_diag_r);
66
66
 
67
67
  /**
68
68
  * Name of the linear solver.
@@ -5,12 +5,13 @@
5
5
  extern "C" {
6
6
  #endif
7
7
 
8
- #include "scs.h"
8
+ #include "glbopts.h"
9
+ #include "scs_work.h"
9
10
 
10
- void SCS(normalize_sol)(ScsWork *w, ScsSolution *sol);
11
- void SCS(un_normalize_sol)(ScsWork *w, ScsSolution *sol);
12
- void SCS(un_normalize_primal)(ScsWork *w, scs_float *r);
13
- void SCS(un_normalize_dual)(ScsWork *w, scs_float *r);
11
+ void SCS(normalize_sol)(ScsScaling *scal, ScsSolution *sol);
12
+ void SCS(un_normalize_sol)(ScsScaling *scal, ScsSolution *sol);
13
+ void SCS(un_normalize_primal)(ScsScaling *scal, scs_float *r);
14
+ void SCS(un_normalize_dual)(ScsScaling *scal, scs_float *r);
14
15
 
15
16
  #ifdef __cplusplus
16
17
  }