This commit is contained in:
2018-10-21 14:30:11 +02:00
parent df49bc9441
commit c6c8a6a5ba
2 changed files with 7 additions and 6 deletions

View File

@@ -14,7 +14,8 @@ fn det(m: &[f32], x: usize) -> f32 {
.enumerate()
.skip(x)
.filter(|(i, _)| (i % x) != n)
.map(|(_, v)| *v).collect::<Vec<_>>();
.map(|(_, v)| *v)
.collect::<Vec<_>>();
d += (-1.0f32).powi(n as i32) * m[n] * det(&ms, x - 1);
}
@@ -52,7 +53,7 @@ impl Matrix {
}
pub fn minor(&self, row_n: usize, col_n: usize) -> Matrix {
let mut matrix = Matrix::new(self.height - 1 , self.width - 1);
let mut matrix = Matrix::new(self.height - 1, self.width - 1);
let mut nr = 0;
@@ -120,8 +121,6 @@ impl Matrix {
}
}
impl ops::Index<(usize, usize)> for Matrix {
type Output = f32;