scs 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +11 -6
  4. data/lib/scs/ffi.rb +30 -13
  5. data/lib/scs/solver.rb +32 -9
  6. data/lib/scs/version.rb +1 -1
  7. data/vendor/scs/CITATION.cff +39 -0
  8. data/vendor/scs/CMakeLists.txt +7 -8
  9. data/vendor/scs/Makefile +24 -15
  10. data/vendor/scs/README.md +5 -263
  11. data/vendor/scs/include/aa.h +67 -23
  12. data/vendor/scs/include/cones.h +17 -17
  13. data/vendor/scs/include/glbopts.h +98 -32
  14. data/vendor/scs/include/linalg.h +2 -4
  15. data/vendor/scs/include/linsys.h +58 -44
  16. data/vendor/scs/include/normalize.h +3 -3
  17. data/vendor/scs/include/rw.h +8 -2
  18. data/vendor/scs/include/scs.h +293 -133
  19. data/vendor/scs/include/util.h +3 -15
  20. data/vendor/scs/linsys/cpu/direct/private.c +220 -224
  21. data/vendor/scs/linsys/cpu/direct/private.h +13 -7
  22. data/vendor/scs/linsys/cpu/direct/private.o +0 -0
  23. data/vendor/scs/linsys/cpu/indirect/private.c +177 -110
  24. data/vendor/scs/linsys/cpu/indirect/private.h +8 -4
  25. data/vendor/scs/linsys/cpu/indirect/private.o +0 -0
  26. data/vendor/scs/linsys/csparse.c +87 -0
  27. data/vendor/scs/linsys/csparse.h +34 -0
  28. data/vendor/scs/linsys/csparse.o +0 -0
  29. data/vendor/scs/linsys/external/amd/SuiteSparse_config.c +1 -1
  30. data/vendor/scs/linsys/external/amd/SuiteSparse_config.o +0 -0
  31. data/vendor/scs/linsys/external/amd/amd_1.o +0 -0
  32. data/vendor/scs/linsys/external/amd/amd_2.o +0 -0
  33. data/vendor/scs/linsys/external/amd/amd_aat.o +0 -0
  34. data/vendor/scs/linsys/external/amd/amd_control.o +0 -0
  35. data/vendor/scs/linsys/external/amd/amd_defaults.o +0 -0
  36. data/vendor/scs/linsys/external/amd/amd_dump.o +0 -0
  37. data/vendor/scs/linsys/external/amd/amd_global.o +0 -0
  38. data/vendor/scs/linsys/external/amd/amd_info.o +0 -0
  39. data/vendor/scs/linsys/external/amd/amd_internal.h +1 -1
  40. data/vendor/scs/linsys/external/amd/amd_order.o +0 -0
  41. data/vendor/scs/linsys/external/amd/amd_post_tree.o +0 -0
  42. data/vendor/scs/linsys/external/amd/amd_postorder.o +0 -0
  43. data/vendor/scs/linsys/external/amd/amd_preprocess.o +0 -0
  44. data/vendor/scs/linsys/external/amd/amd_valid.o +0 -0
  45. data/vendor/scs/linsys/external/qdldl/changes +2 -0
  46. data/vendor/scs/linsys/external/qdldl/qdldl.c +29 -46
  47. data/vendor/scs/linsys/external/qdldl/qdldl.h +33 -41
  48. data/vendor/scs/linsys/external/qdldl/qdldl.o +0 -0
  49. data/vendor/scs/linsys/external/qdldl/qdldl_types.h +11 -3
  50. data/vendor/scs/linsys/gpu/gpu.c +31 -33
  51. data/vendor/scs/linsys/gpu/gpu.h +48 -31
  52. data/vendor/scs/linsys/gpu/indirect/private.c +338 -232
  53. data/vendor/scs/linsys/gpu/indirect/private.h +23 -14
  54. data/vendor/scs/linsys/scs_matrix.c +498 -0
  55. data/vendor/scs/linsys/scs_matrix.h +70 -0
  56. data/vendor/scs/linsys/scs_matrix.o +0 -0
  57. data/vendor/scs/scs.mk +13 -9
  58. data/vendor/scs/src/aa.c +384 -109
  59. data/vendor/scs/src/aa.o +0 -0
  60. data/vendor/scs/src/cones.c +440 -353
  61. data/vendor/scs/src/cones.o +0 -0
  62. data/vendor/scs/src/ctrlc.c +15 -5
  63. data/vendor/scs/src/ctrlc.o +0 -0
  64. data/vendor/scs/src/linalg.c +84 -28
  65. data/vendor/scs/src/linalg.o +0 -0
  66. data/vendor/scs/src/normalize.c +22 -64
  67. data/vendor/scs/src/normalize.o +0 -0
  68. data/vendor/scs/src/rw.c +160 -21
  69. data/vendor/scs/src/rw.o +0 -0
  70. data/vendor/scs/src/scs.c +767 -563
  71. data/vendor/scs/src/scs.o +0 -0
  72. data/vendor/scs/src/scs_indir.o +0 -0
  73. data/vendor/scs/src/scs_version.c +9 -3
  74. data/vendor/scs/src/scs_version.o +0 -0
  75. data/vendor/scs/src/util.c +37 -106
  76. data/vendor/scs/src/util.o +0 -0
  77. data/vendor/scs/test/minunit.h +17 -8
  78. data/vendor/scs/test/problem_utils.h +176 -14
  79. data/vendor/scs/test/problems/degenerate.h +130 -0
  80. data/vendor/scs/test/problems/hs21_tiny_qp.h +124 -0
  81. data/vendor/scs/test/problems/hs21_tiny_qp_rw.h +116 -0
  82. data/vendor/scs/test/problems/infeasible_tiny_qp.h +100 -0
  83. data/vendor/scs/test/problems/qafiro_tiny_qp.h +199 -0
  84. data/vendor/scs/test/problems/random_prob +0 -0
  85. data/vendor/scs/test/problems/random_prob.h +45 -0
  86. data/vendor/scs/test/problems/rob_gauss_cov_est.h +188 -31
  87. data/vendor/scs/test/problems/small_lp.h +13 -14
  88. data/vendor/scs/test/problems/test_fails.h +43 -0
  89. data/vendor/scs/test/problems/unbounded_tiny_qp.h +82 -0
  90. data/vendor/scs/test/random_socp_prob.c +54 -53
  91. data/vendor/scs/test/rng.h +109 -0
  92. data/vendor/scs/test/run_from_file.c +19 -10
  93. data/vendor/scs/test/run_tests.c +27 -3
  94. metadata +20 -8
  95. data/vendor/scs/linsys/amatrix.c +0 -305
  96. data/vendor/scs/linsys/amatrix.h +0 -36
  97. data/vendor/scs/linsys/amatrix.o +0 -0
  98. data/vendor/scs/test/data/small_random_socp +0 -0
  99. data/vendor/scs/test/problems/small_random_socp.h +0 -33
  100. data/vendor/scs/test/run_tests +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0578a2b207262c394530743edb4943b8c1e17d8b56e890f7127bc1db29d74a39'
4
- data.tar.gz: '099d565be542333322a4a7fad5fd5b45d6ce16f3c6bedd1335ed92c8f534842d'
3
+ metadata.gz: b9f5ea6b779ddcbadb769df873b68fa590378cb01aa8770fe3e4efebf471f487
4
+ data.tar.gz: 4e218fccbf2270d438d57f9d7efbd793838a250845d3aae09a1229ca250595bc
5
5
  SHA512:
6
- metadata.gz: 2fc5791159501b367a295502936c6696a0d170a86ecc07e1c4937d3e7030f8759cdf6df988dea2ccb14cb444e931cc390dcc4cecc7e31b5714f97dc62e3b2e40
7
- data.tar.gz: da1556dc4a0430bf772955cf7e91da186d2df43f6a52765a13cba95c3b75a895bb76b8408ecb4f8ae77f427d3b026a5517fa8bbe81ed4e896286eea7ca4414bc
6
+ metadata.gz: b58f4154cd9ab36ed7fc152bbe3ccaa9effc9c820b689503289ab31ccf5dbb3304eb6fb6254b5dbc254f621e40c14740297a5e5c30c33e821f905ec50f9ddf3c
7
+ data.tar.gz: e4f8d67c93889ccdbd5008e97cf4e2875f52dd4209c504eb16bac41b90c942f25cd7312e523fffaed0b35e1c8c6187dd9f858f3c114c73a047ea8ab619525bb8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.0 (2021-10-05)
2
+
3
+ - Updated SCS to 3.0.0
4
+
1
5
  ## 0.2.3 (2021-09-09)
2
6
 
3
7
  - Updated SCS to 2.1.4
data/README.md CHANGED
@@ -39,16 +39,21 @@ Default values shown
39
39
  ```ruby
40
40
  solver.solve(data, cone, {
41
41
  normalize: true, # heuristic data rescaling
42
- scale: 1.0, # if normalized, rescales by this factor
43
- rho_x: 1e-3, # x equality constraint scaling
44
- max_iters: 5000, # maximum iterations to take
45
- eps: 1e-5, # convergence tolerance
42
+ scale: 0.1, # if normalized, rescales by this factor
43
+ adaptive_scale: true, # heuristically adapt dual scale through the solve
44
+ rho_x: 1e-6, # x equality constraint scaling
45
+ max_iters: 1e5, # maximum iterations to take
46
+ eps_abs: 1e-4, # absolute feasibility tolerance
47
+ eps_rel: 1e-4, # relative feasibility tolerance
48
+ eps_infeas: 1e-7, # infeasibility tolerance
46
49
  alpha: 1.5, # relaxation parameter
47
- cg_rate: 2.0, # for indirect, tolerance goes down like (1/iter)^cg_rate
50
+ time_limit_secs: nil, # time limit for solve run in seconds
48
51
  verbose: true, # write out progress
49
52
  warm_start: false, # warm start
50
53
  acceleration_lookback: 10, # memory for acceleration
51
- write_data_filename: nil # filename to write data if set
54
+ acceleration_interval: 10, # iterations to run Anderson acceleration
55
+ write_data_filename: nil, # filename to write data if set
56
+ log_csv_filename: nil # write csv logs of various quantities
52
57
  })
53
58
  ```
54
59
 
data/lib/scs/ffi.rb CHANGED
@@ -41,14 +41,17 @@ module SCS
41
41
  "scs_int m",
42
42
  "scs_int n",
43
43
  "ScsMatrix *a",
44
+ "ScsMatrix *p",
44
45
  "scs_float *b",
45
46
  "scs_float *c",
46
- "ScsSettings *stgs"
47
47
  ]
48
48
 
49
49
  m::Cone = struct [
50
- "scs_int f",
50
+ "scs_int z",
51
51
  "scs_int l",
52
+ "scs_float *bu",
53
+ "scs_float *bl",
54
+ "scs_int *bsize",
52
55
  "scs_int *q",
53
56
  "scs_int qsize",
54
57
  "scs_int *s",
@@ -67,31 +70,45 @@ module SCS
67
70
 
68
71
  m::Info = struct [
69
72
  "scs_int iter",
70
- "char status[32]",
73
+ "char status[128]",
71
74
  "scs_int status_val",
75
+ "scs_int scale_updates",
72
76
  "scs_float pobj",
73
77
  "scs_float dobj",
74
78
  "scs_float res_pri",
75
79
  "scs_float res_dual",
80
+ "scs_float gap",
76
81
  "scs_float res_infeas",
77
- "scs_float res_unbdd",
78
- "scs_float rel_gap",
82
+ "scs_float res_unbdd_a",
83
+ "scs_float res_unbdd_p",
79
84
  "scs_float setup_time",
80
- "scs_float solve_time"
85
+ "scs_float solve_time",
86
+ "scs_float scale",
87
+ "scs_float comp_slack",
88
+ "scs_int rejected_accel_steps",
89
+ "scs_int accepted_accel_steps",
90
+ "scs_float lin_sys_time",
91
+ "scs_float cone_time",
92
+ "scs_float accel_time"
81
93
  ]
82
94
 
83
95
  m::Settings = struct [
84
96
  "scs_int normalize",
85
97
  "scs_float scale",
98
+ "scs_int adaptive_scale",
86
99
  "scs_float rho_x",
87
100
  "scs_int max_iters",
88
- "scs_float eps",
101
+ "scs_float eps_abs",
102
+ "scs_float eps_rel",
103
+ "scs_float eps_infeas",
89
104
  "scs_float alpha",
90
- "scs_float cg_rate",
105
+ "scs_float time_limit_secs",
91
106
  "scs_int verbose",
92
107
  "scs_int warm_start",
93
108
  "scs_int acceleration_lookback",
94
- "const char* write_data_filename"
109
+ "scs_int acceleration_interval",
110
+ "const char* write_data_filename",
111
+ "const char *log_csv_filename"
95
112
  ]
96
113
 
97
114
  m::Matrix = struct [
@@ -103,14 +120,14 @@ module SCS
103
120
  ]
104
121
 
105
122
  # scs.h
106
- extern "ScsWork *scs_init(const ScsData *d, const ScsCone *k, ScsInfo *info)"
107
- extern "scs_int scs_solve(ScsWork *w, const ScsData *d, const ScsCone *k, ScsSolution *sol, ScsInfo *info)"
123
+ extern "ScsWork *scs_init(const ScsData *d, const ScsCone *k, const ScsSettings *stgs)"
124
+ extern "scs_int scs_solve(ScsWork *w, ScsSolution *sol, ScsInfo *info)"
108
125
  extern "void scs_finish(ScsWork *w)"
109
- extern "scs_int scs(const ScsData *d, const ScsCone *k, ScsSolution *sol, ScsInfo *info)"
126
+ extern "scs_int scs(const ScsData *d, const ScsCone *k, const ScsSettings *stgs, ScsSolution *sol, ScsInfo *info)"
110
127
  extern "const char *scs_version(void)"
111
128
 
112
129
  # utils.h
113
- extern "void scs_set_default_settings(ScsData *d)"
130
+ extern "void scs_set_default_settings(ScsSettings *stgs)"
114
131
  end
115
132
  end
116
133
  end
data/lib/scs/solver.rb CHANGED
@@ -6,13 +6,13 @@ module SCS
6
6
 
7
7
  def solve(data, cone, **settings)
8
8
  cdata = create_data(data)
9
- set_settings(cdata, settings)
9
+ settings = create_settings(settings)
10
10
  ccone = create_cone(cone)
11
11
 
12
12
  solution = calloc(ffi::Solution.size) # alloc clear memory
13
13
  info = ffi::Info.malloc
14
14
 
15
- ffi.scs(cdata, ccone, solution, info)
15
+ ffi.scs(cdata, ccone, settings, solution, info)
16
16
 
17
17
  solution = ffi::Solution.new(solution)
18
18
  x = read_float_array(solution.x, cdata.n)
@@ -26,15 +26,24 @@ module SCS
26
26
  iter: info.iter,
27
27
  status: read_string(info.status),
28
28
  status_val: info.status_val,
29
+ scale_updates: info.scale_updates,
29
30
  pobj: info.pobj,
30
31
  dobj: info.dobj,
31
32
  res_pri: info.res_pri,
32
33
  res_dual: info.res_dual,
34
+ gap: info.gap,
33
35
  res_infeas: info.res_infeas,
34
- res_unbdd: info.res_unbdd,
35
- rel_gap: info.rel_gap,
36
+ res_unbdd_a: info.res_unbdd_a,
37
+ res_unbdd_p: info.res_unbdd_p,
36
38
  setup_time: info.setup_time,
37
- solve_time: info.solve_time
39
+ solve_time: info.solve_time,
40
+ scale: info.scale,
41
+ comp_slack: info.comp_slack,
42
+ rejected_accel_steps: info.rejected_accel_steps,
43
+ accepted_accel_steps: info.accepted_accel_steps,
44
+ lin_sys_time: info.lin_sys_time,
45
+ cone_time: info.cone_time,
46
+ accel_time: info.accel_time
38
47
  }
39
48
  end
40
49
 
@@ -114,15 +123,30 @@ module SCS
114
123
  cdata.m = m
115
124
  cdata.n = n
116
125
  cdata.a = csc_matrix(data[:a])
126
+
127
+ if data[:p]
128
+ raise ArgumentError, "Bad p shape" if shape(data[:p]) != [n, n]
129
+ cdata.p = csc_matrix(data[:p])
130
+ end
131
+
132
+ raise ArgumentError, "Bad b size" if data[:b].to_a.size != m
117
133
  cdata.b = float_array(data[:b])
134
+
135
+ raise ArgumentError, "Bad c size" if data[:c].to_a.size != n
118
136
  cdata.c = float_array(data[:c])
119
137
  cdata
120
138
  end
121
139
 
122
140
  def create_cone(cone)
123
141
  ccone = ffi::Cone.malloc
124
- ccone.f = cone[:f].to_i
142
+ ccone.z = cone[:z].to_i
125
143
  ccone.l = cone[:l].to_i
144
+ ccone.bu = float_array(cone[:bu])
145
+ ccone.bl = float_array(cone[:bl])
146
+ if cone[:bu].to_a.size != cone[:bl].to_a.size
147
+ raise ArgumentError, "Expected bu and bl size to match"
148
+ end
149
+ ccone.bsize = cone[:bu].to_a.size
126
150
  ccone.q = int_array(cone[:q])
127
151
  ccone.qsize = cone[:q].to_a.size
128
152
  ccone.s = int_array(cone[:s])
@@ -134,10 +158,9 @@ module SCS
134
158
  ccone
135
159
  end
136
160
 
137
- def set_settings(data, settings)
161
+ def create_settings(settings)
138
162
  set = ffi::Settings.malloc
139
- data.stgs = set
140
- ffi.scs_set_default_settings(data)
163
+ ffi.scs_set_default_settings(set)
141
164
 
142
165
  # hack for setting members with []=
143
166
  # safer than send("#{k}=", v)
data/lib/scs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SCS
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,39 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ authors:
4
+ - family-names: "O'Donoghue"
5
+ given-names: "Brendan"
6
+ - family-names: "Chu"
7
+ given-names: "Eric"
8
+ - family-names: "Parikh"
9
+ given-names: "Neal"
10
+ - family-names: "Boyd"
11
+ given-names: "Stephen"
12
+ title: "SCS: Spltting Conic Solver"
13
+ version: 3.0.0
14
+ date-released: 2021
15
+ url: "https://github.com/cvxgrp/scs"
16
+
17
+ # Original SCS paper:
18
+ preferred-citation:
19
+ type: article
20
+ authors:
21
+ - family-names: "O'Donoghue"
22
+ given-names: "Brendan"
23
+ - family-names: "Chu"
24
+ given-names: "Eric"
25
+ - family-names: "Parikh"
26
+ given-names: "Neal"
27
+ - family-names: "Boyd"
28
+ given-names: "Stephen"
29
+ journal: "Journal of Optimization Theory and Applications"
30
+ month: 6
31
+ start: 1042 # Start pages
32
+ end: 1068 # End pages
33
+ title: "Conic Optimization via Operator Splitting and Homogeneous Self-Dual Embedding"
34
+ issue: 3
35
+ volume: 169
36
+ year: 2016
37
+ doi: 10.1007/s10957-016-0892-3
38
+ url: https://dx.doi.org/10.1007/s10957-016-0892-3
39
+
@@ -107,7 +107,8 @@ set(${PROJECT_NAME}_SRC
107
107
  src/scs.c
108
108
  src/scs_version.c
109
109
  src/util.c
110
- ${LINSYS}/amatrix.c)
110
+ ${LINSYS}/csparse.c
111
+ ${LINSYS}/scs_matrix.c)
111
112
 
112
113
  # Common header files
113
114
  set(${PROJECT_NAME}_HDR
@@ -122,7 +123,8 @@ set(${PROJECT_NAME}_HDR
122
123
  include/scs.h
123
124
  include/scs_blas.h
124
125
  include/util.h
125
- ${LINSYS}/amatrix.h)
126
+ ${LINSYS}/csparse.h
127
+ ${LINSYS}/scs_matrix.h)
126
128
 
127
129
  # get all the c file in amd/external
128
130
  file(GLOB ${PROJECT_NAME}_AMD_EXTERNAL_SRC
@@ -160,7 +162,7 @@ target_include_directories(${${PROJECT_NAME}_DIRECT} PUBLIC
160
162
  "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
161
163
 
162
164
  # Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
163
- target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE -DUSE_LAPACK)
165
+ target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE -DUSE_LAPACK -DCOPYAMATRIX -DCTRLC)
164
166
 
165
167
  # The library depends on math (m) blas and lapack
166
168
  target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE
@@ -194,11 +196,8 @@ add_library(${${PROJECT_NAME}_INDIRECT}
194
196
  ${${PROJECT_NAME}_HDR}
195
197
  ${${PROJECT_NAME}_SRC}
196
198
  ${INDIRSRC}/private.c
199
+ ${INDIRSRC}/private.h
197
200
  ${${${PROJECT_NAME}_INDIRECT}_HDR}
198
- ${EXTERNAL}/qdldl/qdldl.c
199
- ${${PROJECT_NAME}_AMD_EXTERNAL_SRC}
200
- ${${PROJECT_NAME}_AMD_EXTERNAL_HDR}
201
- ${${PROJECT_NAME}_LDL_EXTERNAL_SRC}
202
201
  )
203
202
 
204
203
 
@@ -210,7 +209,7 @@ target_include_directories(${${PROJECT_NAME}_INDIRECT} PUBLIC
210
209
  "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
211
210
 
212
211
  # Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
213
- target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE -DUSE_LAPACK)
212
+ target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE -DUSE_LAPACK -DCOPYAMATRIX -DCTRLC -DINDIRECT)
214
213
 
215
214
  # The library depends on math (m) blas and lapack
216
215
  target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC
data/vendor/scs/Makefile CHANGED
@@ -1,7 +1,9 @@
1
1
  # MAKEFILE for scs
2
2
  include scs.mk
3
3
 
4
- SCS_OBJECTS = src/scs.o src/util.o src/cones.o src/aa.o src/rw.o src/linalg.o src/ctrlc.o src/scs_version.o src/normalize.o
4
+ SCS_OBJECTS = src/util.o src/cones.o src/aa.o src/rw.o src/linalg.o src/ctrlc.o src/scs_version.o src/normalize.o
5
+ SCS_O = src/scs.o
6
+ SCS_INDIR_O = src/scs_indir.o
5
7
 
6
8
  SRC_FILES = $(wildcard src/*.c)
7
9
  INC_FILES = $(wildcard include/*.h)
@@ -17,7 +19,7 @@ TARGETS = $(OUT)/demo_socp_indirect $(OUT)/demo_socp_direct $(OUT)/run_from_file
17
19
  default: $(TARGETS) $(OUT)/libscsdir.a $(OUT)/libscsindir.a $(OUT)/libscsdir.$(SHARED) $(OUT)/libscsindir.$(SHARED)
18
20
  @echo "****************************************************************************************"
19
21
  @echo "Successfully compiled scs, copyright Brendan O'Donoghue 2012."
20
- @echo "To test, type '$(OUT)/demo_socp_indirect' to solve a random SOCP."
22
+ @echo "To test, type '$(OUT)/demo_socp_direct' to solve a random SOCP."
21
23
  @echo "**********************************************************************************"
22
24
  ifneq ($(USE_LAPACK), 0)
23
25
  @echo "Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs"
@@ -28,38 +30,43 @@ else
28
30
  endif
29
31
  @echo "****************************************************************************************"
30
32
 
33
+ $(SCS_O): src/scs.c $(INC_FILES)
34
+ $(CC) $(CFLAGS) -c $< -o $@
35
+
36
+ $(SCS_INDIR_O): src/scs.c $(INC_FILES)
37
+ $(CC) $(CFLAGS) -DINDIRECT=1 -c $< -o $@
38
+
31
39
  %.o : src/%.c
32
40
  $(CC) $(CFLAGS) -c $< -o $@
33
41
 
34
- src/scs.o : $(SRC_FILES) $(INC_FILES)
35
42
  src/util.o : src/util.c include/util.h include/glbopts.h
36
43
  src/cones.o : src/cones.c include/cones.h include/scs_blas.h
37
44
  src/aa.o : src/aa.c include/aa.h include/scs_blas.h
38
45
  src/rw.o : src/rw.c include/rw.h
39
- src/cs.o : src/cs.c include/cs.h
40
46
  src/linalg.o: src/linalg.c include/linalg.h
41
47
  src/ctrl.o : src/ctrl.c include/ctrl.h
42
48
  src/scs_version.o: src/scs_version.c include/glbopts.h
43
49
 
44
50
  $(DIRSRC)/private.o: $(DIRSRC)/private.c $(DIRSRC)/private.h
45
51
  $(INDIRSRC)/indirect/private.o: $(INDIRSRC)/private.c $(INDIRSRC)/private.h
46
- $(LINSYS)/amatrix.o: $(LINSYS)/amatrix.c $(LINSYS)/amatrix.h
52
+ $(LINSYS)/scs_matrix.o: $(LINSYS)/scs_matrix.c $(LINSYS)/scs_matrix.h
53
+ $(LINSYS)/csparse.o: $(LINSYS)/csparse.c $(LINSYS)/csparse.h
47
54
 
48
- $(OUT)/libscsdir.a: $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/amatrix.o
55
+ $(OUT)/libscsdir.a: $(SCS_O) $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
49
56
  mkdir -p $(OUT)
50
57
  $(ARCHIVE) $@ $^
51
58
  - $(RANLIB) $@
52
59
 
53
- $(OUT)/libscsindir.a: $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINSYS)/amatrix.o
60
+ $(OUT)/libscsindir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
54
61
  mkdir -p $(OUT)
55
62
  $(ARCHIVE) $@ $^
56
63
  - $(RANLIB) $@
57
64
 
58
- $(OUT)/libscsdir.$(SHARED): $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/amatrix.o
65
+ $(OUT)/libscsdir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(DIRSRC)/private.o $(AMD_OBJS) $(LDL_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
59
66
  mkdir -p $(OUT)
60
67
  $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS)
61
68
 
62
- $(OUT)/libscsindir.$(SHARED): $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINSYS)/amatrix.o
69
+ $(OUT)/libscsindir.$(SHARED): $(SCS_INDIR_O) $(SCS_OBJECTS) $(INDIRSRC)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o
63
70
  mkdir -p $(OUT)
64
71
  $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS)
65
72
 
@@ -110,20 +117,20 @@ $(LINSYS)/gpu/gpu.o: $(LINSYS)/gpu/gpu.c
110
117
  $(GPUINDIR)/private.o: $(GPUINDIR)/private.c
111
118
  $(CUCC) -c -o $(GPUINDIR)/private.o $^ $(CUDAFLAGS)
112
119
 
113
- # $(OUT)/libscsgpudir.$(SHARED): $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/amatrix.o $(LINSYS)/gpu/gpu.o
120
+ # $(OUT)/libscsgpudir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
114
121
  # mkdir -p $(OUT)
115
122
  # $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(CULDFLAGS)
116
123
 
117
- # $(OUT)/libscsgpudir.a: $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/amatrix.o $(LINSYS)/gpu/gpu.o
124
+ # $(OUT)/libscsgpudir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(GPUDIR)/private.o $(AMD_OBJS) $(LINSYS)/scs_matrix.o $(LINSYS)/gpu/gpu.o
118
125
  # mkdir -p $(OUT)
119
126
  # $(ARCHIVE) $@ $^
120
127
  # - $(RANLIB) $@
121
128
 
122
- $(OUT)/libscsgpuindir.$(SHARED): $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/amatrix.o $(LINSYS)/gpu/gpu.o
129
+ $(OUT)/libscsgpuindir.$(SHARED): $(SCS_O) $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o $(LINSYS)/gpu/gpu.o
123
130
  mkdir -p $(OUT)
124
131
  $(CC) $(CFLAGS) -shared -Wl,$(SONAME),$(@:$(OUT)/%=%) -o $@ $^ $(LDFLAGS) $(CULDFLAGS)
125
132
 
126
- $(OUT)/libscsgpuindir.a: $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/amatrix.o $(LINSYS)/gpu/gpu.o
133
+ $(OUT)/libscsgpuindir.a: $(SCS_INDIR_O) $(SCS_OBJECTS) $(GPUINDIR)/private.o $(LINSYS)/scs_matrix.o $(LINSYS)/csparse.o $(LINSYS)/gpu/gpu.o
127
134
  mkdir -p $(OUT)
128
135
  $(ARCHIVE) $@ $^
129
136
  - $(RANLIB) $@
@@ -136,7 +143,7 @@ $(OUT)/demo_socp_gpu_indirect: test/random_socp_prob.c $(OUT)/libscsgpuindir.a
136
143
 
137
144
  .PHONY: clean purge
138
145
  clean:
139
- @rm -rf $(TARGETS) $(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
140
147
  @rm -rf $(OUT)/*.dSYM
141
148
  @rm -rf matlab/*.mex*
142
149
  @rm -rf .idea
@@ -153,7 +160,7 @@ INSTALL_GPU_TARGETS = $(OUT)/libscsgpuindir.a $(OUT)/libscsgpuindir.$(SHARED) #
153
160
  INSTALL_INC_DIR = $(DESTDIR)$(PREFIX)/include/scs/
154
161
  INSTALL_LIB_DIR = $(DESTDIR)$(PREFIX)/lib/
155
162
 
156
- .PHONY: install install_gpu
163
+ .PHONY: install install_gpu direct indirect
157
164
  install: $(INSTALL_INC_FILES) $(INSTALL_TARGETS)
158
165
  $(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
159
166
  $(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
@@ -162,3 +169,5 @@ install_gpu: $(INSTALL_INC_FILES) $(INSTALL_GPU_TARGETS)
162
169
  $(INSTALL) -d $(INSTALL_INC_DIR) $(INSTALL_LIB_DIR)
163
170
  $(INSTALL) -m 644 $(INSTALL_INC_FILES) $(INSTALL_INC_DIR)
164
171
  $(INSTALL) -m 644 $(INSTALL_GPU_TARGETS) $(INSTALL_LIB_DIR)
172
+ direct:$(OUT)/libscsdir.$(SHARED) $(OUT)/demo_socp_direct $(OUT)/run_from_file_direct $(OUT)/run_tests_direct
173
+ indirect:$(OUT)/libscsindir.$(SHARED) $(OUT)/demo_socp_indirect $(OUT)/run_from_file_indirect $(OUT)/run_tests_indirect