Skip to content
Snippets Groups Projects
Commit a31926da authored by fefe's avatar fefe
Browse files

Few fonctions made like .det() -> already tested , mul -> tested, creation...

Few fonctions made like .det() -> already tested , mul -> tested, creation function -> tested, info function tested
parent abce7fba
Branches
Tags
No related merge requests found
......@@ -120,11 +120,11 @@ public class Matrix {
} else {
double tot = 0.0;
for (int i = 0; i < this.nbCols();i++){
if (i+this.nbCols() % 2 == 0){
tot += this.removed(i, 0).mul(this.get(i, 0)).det();
if (i % 2 == 0){
tot += this.removed(i, 0).det() * this.get(i,0);
}
else{
tot -= this.removed(i, 0).mul(this.get(i, 0)).det();
tot += this.removed(i, 0).det() * this.get(i,0) * (-1.0);
}
}
return tot;
......
......@@ -207,7 +207,11 @@ class VectorTest {
lstVec.add(Vector.of(3.0,6.0,9.0));
Matrix mat = Matrix.of(lstVec);
assertEquals(mat.det(), 0.0);
lstVec = new ArrayList<>();
lstVec.add(Vector.of(1.0, 5.0, 9.0, 13.0));
lstVec.add(Vector.of(2.0, 6.0, 10.0, 14.0));
lstVec.add(Vector.of(3.0, 7.0, 11.0, 15.0));
lstVec.add(Vector.of(4.0,8.0,12.0, 16.0));
assertEquals(Matrix.of(lstVec).det(), 0.0);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment