[FEAT] Matrix : add minor

This commit is contained in:
NADAL Jean-Baptiste
2024-02-02 17:50:54 +01:00
parent a584bf54d8
commit 45dc3049e7
3 changed files with 25 additions and 0 deletions

View File

@@ -277,3 +277,20 @@ TEST_CASE("[Matrix] A submatrix of a 4x4 matrix is a 3x3 matrix", "[Matrix]")
REQUIRE(a.sub_matrix(2, 1) == b);
}
/* ------------------------------------------------------------------------- */
TEST_CASE("[Matrix] Calculating a minor of a 3x3 matrix", "[Matrix]")
{
Matrix a = {
{3, 5, 0},
{2, -1, -7},
{6, -1, 5}
};
Matrix b = a.sub_matrix(1, 0);
REQUIRE(b.determinant() == 25);
REQUIRE(a.minor(1, 0) == 25);
}