From eb6c5d9a69af522628d9a0ce1969b2eb1fc261a1 Mon Sep 17 00:00:00 2001 From: goulart-paul Date: Wed, 29 May 2024 13:13:09 +0100 Subject: [PATCH] enlarge unsafe block in factor --- src/qdldl/qdldl.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qdldl/qdldl.rs b/src/qdldl/qdldl.rs index 011a204..d3fba18 100644 --- a/src/qdldl/qdldl.rs +++ b/src/qdldl/qdldl.rs @@ -571,13 +571,14 @@ fn _factor_inner( for (&Lxj, &Lij) in zip(&Lx[f..l], &Li[f..l]) { *(y_vals.get_unchecked_mut(Lij)) -= Lxj * y_vals_cidx; } - } - // Now I have the cidx^th element of y = L\b. - // so compute the corresponding element of - // this row of L and put it into the right place - Lx[tmp_idx] = y_vals_cidx * Dinv[cidx]; - D[k] -= y_vals_cidx * Lx[tmp_idx]; + // Now I have the cidx^th element of y = L\b. + // so compute the corresponding element of + // this row of L and put it into the right place + let Lx_tmp_idx = y_vals_cidx * *Dinv.get_unchecked(cidx); + *Lx.get_unchecked_mut(tmp_idx) = Lx_tmp_idx; + *D.get_unchecked_mut(k) -= y_vals_cidx * Lx_tmp_idx; + } } // record which row it went into