From 02c557c4a37523564484ced471b768797aa87821 Mon Sep 17 00:00:00 2001 From: Jon Janzen Date: Fri, 2 Apr 2021 15:00:00 -0600 Subject: [PATCH] slightly better minor --- matrix/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/matrix/src/lib.rs b/matrix/src/lib.rs index 1282632..3fd5409 100644 --- a/matrix/src/lib.rs +++ b/matrix/src/lib.rs @@ -83,11 +83,11 @@ impl Matrix { } pub fn cofactor(&self, row: usize, col: usize) -> f32 { - self.minor(row, col) * if row + col % 1 == 0 { - 1.0 - } - else { - -1.0 + let minor = self.minor(row, col); + if row + col % 1 == 0 { + minor + } else { + minor * -1.0 } }