vendor/scs/linsys/scs_matrix.c in scs-0.4.0 vs vendor/scs/linsys/scs_matrix.c in scs-0.4.1
- old
+ new
@@ -115,10 +115,11 @@
static void compute_ruiz_mats(ScsMatrix *P, ScsMatrix *A, scs_float *Dt,
scs_float *Et, ScsConeWork *cone) {
scs_int i, j, kk;
scs_float wrk;
+ scs_float nm_a_col;
/**************************** D ****************************/
/* initialize D */
for (i = 0; i < A->m; ++i) {
@@ -136,11 +137,12 @@
/* accumulate D across each cone */
SCS(enforce_cone_boundaries)(cone, Dt, &SCS(norm_inf));
/* invert temporary vec to form D */
for (i = 0; i < A->m; ++i) {
- Dt[i] = SAFEDIV_POS(1.0, SQRTF(apply_limit(Dt[i])));
+ Dt[i] = SQRTF(apply_limit(Dt[i]));
+ Dt[i] = SAFEDIV_POS(1.0, Dt[i]);
}
/**************************** E ****************************/
/* initialize E */
@@ -167,12 +169,14 @@
}
}
/* calculate col norms, E */
for (i = 0; i < A->n; ++i) {
- Et[i] = MAX(Et[i], SCS(norm_inf)(&(A->x[A->p[i]]), A->p[i + 1] - A->p[i]));
- Et[i] = SAFEDIV_POS(1.0, SQRTF(apply_limit(Et[i])));
+ nm_a_col = SCS(norm_inf)(&(A->x[A->p[i]]), A->p[i + 1] - A->p[i]);
+ Et[i] = MAX(Et[i], nm_a_col);
+ Et[i] = SQRTF(apply_limit(Et[i]));
+ Et[i] = SAFEDIV_POS(1.0, Et[i]);
}
}
static void compute_l2_mats(ScsMatrix *P, ScsMatrix *A, scs_float *Dt,
scs_float *Et, ScsConeWork *cone) {
@@ -199,11 +203,12 @@
/* accumulate D across each cone */
SCS(enforce_cone_boundaries)(cone, Dt, &SCS(mean));
for (i = 0; i < A->m; ++i) {
- Dt[i] = SAFEDIV_POS(1.0, SQRTF(apply_limit(Dt[i])));
+ Dt[i] = SQRTF(apply_limit(Dt[i]));
+ Dt[i] = SAFEDIV_POS(1.0, Dt[i]);
}
/**************************** E ****************************/
/* initialize E */
@@ -231,10 +236,11 @@
}
/* calculate col norms, E */
for (i = 0; i < A->n; ++i) {
Et[i] += SCS(norm_sq)(&(A->x[A->p[i]]), A->p[i + 1] - A->p[i]);
- Et[i] = SAFEDIV_POS(1.0, SQRTF(apply_limit(SQRTF(Et[i]))));
+ Et[i] = SQRTF(apply_limit(SQRTF(Et[i])));
+ Et[i] = SAFEDIV_POS(1.0, Et[i]);
}
}
static void rescale(ScsMatrix *P, ScsMatrix *A, scs_float *Dt, scs_float *Et,
ScsScaling *scal, ScsConeWork *cone) {