removed useless if

This commit is contained in:
Nestor Demeure 2019-11-02 19:28:46 +01:00
parent d4d3f69429
commit 19fce3addc
1 changed files with 13 additions and 14 deletions

View File

@ -159,6 +159,7 @@ where
let mut x = x.clone_owned(); let mut x = x.clone_owned();
let mut beta = crate::one::<N::RealField>(); let mut beta = crate::one::<N::RealField>();
for j in 0..n { for j in 0..n {
// updates the diagonal
let diag = N::real(unsafe { *self.chol.get_unchecked((j, j)) }); let diag = N::real(unsafe { *self.chol.get_unchecked((j, j)) });
let diag2 = diag * diag; let diag2 = diag * diag;
let xj = unsafe { *x.get_unchecked(j) }; let xj = unsafe { *x.get_unchecked(j) };
@ -167,8 +168,7 @@ where
let new_diag = (diag2 + sigma_xj2 / beta).sqrt(); let new_diag = (diag2 + sigma_xj2 / beta).sqrt();
unsafe { *self.chol.get_unchecked_mut((j, j)) = N::from_real(new_diag) }; unsafe { *self.chol.get_unchecked_mut((j, j)) = N::from_real(new_diag) };
beta += sigma_xj2 / diag2; beta += sigma_xj2 / diag2;
// Update the terms of L // updates the terms of L
if j < n {
let mut xjplus = x.rows_range_mut(j + 1..); let mut xjplus = x.rows_range_mut(j + 1..);
let mut col_j = self.chol.slice_range_mut(j + 1.., j); let mut col_j = self.chol.slice_range_mut(j + 1.., j);
// temp_jplus -= (wj / N::from_real(diag)) * col_j; // temp_jplus -= (wj / N::from_real(diag)) * col_j;
@ -183,7 +183,6 @@ where
} }
} }
} }
}
} }
impl<N: ComplexField, D: DimSub<Dynamic>, S: Storage<N, D, D>> SquareMatrix<N, D, S> impl<N: ComplexField, D: DimSub<Dynamic>, S: Storage<N, D, D>> SquareMatrix<N, D, S>