vendor/scs/linsys/cpu/indirect/private.c in scs-0.4.0 vs vendor/scs/linsys/cpu/indirect/private.c in scs-0.4.1
- old
+ new
@@ -1,24 +1,11 @@
#include "private.h"
-#include "linsys.h"
-#include "util.h"
-#include <limits.h>
-const char *SCS(get_lin_sys_method)() {
- return "sparse-indirect";
+const char *scs_get_lin_sys_method() {
+ return "sparse-indirect-scs";
}
-/*
-char *SCS(get_lin_sys_summary)(ScsLinSysWork *p, const ScsInfo *info) {
- char *str = (char *)scs_malloc(sizeof(char) * 128);
- sprintf(str, "lin-sys: avg cg its: %2.2f\n",
- (scs_float)p->tot_cg_its / (info->iter + 1));
- p->tot_cg_its = 0;
- return str;
-}
-*/
-
/* Not possible to do this on the fly due to M_ii += a_i' (R_y)^-1 a_i */
/* set M = inv ( diag ( R_x + P + A' R_y^{-1} A ) ) */
static void set_preconditioner(ScsLinSysWork *p) {
scs_int i, k;
scs_float *M = p->M;
@@ -95,11 +82,11 @@
scs_printf("finished transposing A, time: %1.2es\n",
SCS(tocq)(&transpose_timer) / 1e3);
#endif
}
-void SCS(free_lin_sys_work)(ScsLinSysWork *p) {
+void scs_free_lin_sys_work(ScsLinSysWork *p) {
if (p) {
scs_free(p->p);
scs_free(p->r);
scs_free(p->Gp);
scs_free(p->tmp);
@@ -160,17 +147,17 @@
z[i] = r[i] * M[i];
}
}
/* no need to update anything in this case */
-void SCS(update_lin_sys_diag_r)(ScsLinSysWork *p, const scs_float *diag_r) {
+void scs_update_lin_sys_diag_r(ScsLinSysWork *p, const scs_float *diag_r) {
p->diag_r = diag_r; /* this isn't needed but do it to be safe */
set_preconditioner(p);
}
-ScsLinSysWork *SCS(init_lin_sys_work)(const ScsMatrix *A, const ScsMatrix *P,
- const scs_float *diag_r) {
+ScsLinSysWork *scs_init_lin_sys_work(const ScsMatrix *A, const ScsMatrix *P,
+ const scs_float *diag_r) {
ScsLinSysWork *p = (ScsLinSysWork *)scs_calloc(1, sizeof(ScsLinSysWork));
p->A = A;
p->P = P;
p->m = A->m;
p->n = A->n;
@@ -196,11 +183,11 @@
set_preconditioner(p);
p->tot_cg_its = 0;
if (!p->p || !p->r || !p->Gp || !p->tmp || !p->At || !p->At->i || !p->At->p ||
!p->At->x) {
- SCS(free_lin_sys_work)(p);
+ scs_free_lin_sys_work(p);
return SCS_NULL;
}
return p;
}
@@ -286,11 +273,11 @@
*
* x = (R_x + P + A' R_y^{-1} A)^{-1} (rx + A' R_y^{-1} ry)
* y = R_y^{-1} (Ax - ry)
*
*/
-scs_int SCS(solve_lin_sys)(ScsLinSysWork *p, scs_float *b, const scs_float *s,
- scs_float tol) {
+scs_int scs_solve_lin_sys(ScsLinSysWork *p, scs_float *b, const scs_float *s,
+ scs_float tol) {
scs_int cg_its, max_iters;
if (tol <= 0.) {
scs_printf("Warning: tol = %4f <= 0, likely compiled without setting "
"INDIRECT flag.\n",