We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4518f4 commit f987e34Copy full SHA for f987e34
1 file changed
src/structure/matrix.rs
@@ -3293,7 +3293,9 @@ impl LinearAlgebra<Matrix> for Matrix {
3293
///
3294
/// Implementation of [RosettaCode](https://rosettacode.org/wiki/Reduced_row_echelon_form)
3295
fn rref(&self) -> Matrix {
3296
- let epsilon = 1e-10;
+ let max_abs = self.data.iter().fold(0f64, |acc, &x| acc.max(x.abs()));
3297
+ let epsilon = (max_abs * 1e-12).max(1e-15);
3298
+
3299
let mut lead = 0usize;
3300
let mut result = self.clone();
3301
'outer: for r in 0..self.row {
0 commit comments