Skip to content

Commit

Permalink
chore: add comment providing details on the householder fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Mar 28, 2024
1 parent c160299 commit 4dad6b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/linalg/householder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ pub fn reflection_axis_mut<T: ComplexField, D: Dim, S: StorageMut<T, D>>(

if !factor.is_zero() {
column.unscale_mut(factor.sqrt());

// Normalize again, making sure the vector is unit-sized.
// If `factor` had a very small value, the first normalization
// (dividing by `factor.sqrt()`) might end up with a slightly
// non-unit vector (especially when using 32-bits float).
// Decompositions strongly rely on that unit-vector property,
// so we run a second normalization (that is much more numerically
// stable since the norm is close to 1) to ensure it has a unit
// size.
let _ = column.normalize_mut();

(-signed_norm, true)
} else {
// TODO: not sure why we don't have a - sign here.
Expand Down

0 comments on commit 4dad6b3

Please sign in to comment.