rulinalg icon indicating copy to clipboard operation
rulinalg copied to clipboard

Overly strong bounds on singular matrix checks

Open AtheMathmo opened this issue 9 years ago • 1 comments
trafficstars

In places we are checking if entries in the matrix are close to zero by using: entry < n * T::min_positive_value(), where n is a small integer. It is better for us to use a larger value than the min_positive_value (which is somewhere around 1^-300). Instead we should use the new MachineEpsilon trait - or alternatively the new epsilon function in the num crate once it is released.

Places where this occurs (maybe non-exhaustive):

  • matrix/mod.rs in back_substitution
  • matrix/mod.rs in forward_substitution

We should simply replace the min_positive_value function with the epsilon value.

AtheMathmo avatar Sep 28 '16 09:09 AtheMathmo

Just want to note that the right value here needs to be determined on a case-to-case basis. The machine epsilon functions as a maximal upper bound for rounding error, but this may not be right value to compare against. Rigorously determining the right/optimal values either requires somewhat expert knowledge of floating point arithmetic (which I certainly don't have), or reliable advice from established references.

However, I think the T::epsilon() value in any case should be a large improvement over T::min_positive_value().

Andlon avatar Sep 28 '16 09:09 Andlon