File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,44 @@ private function buildMatrix()
1818 ]);
1919 }
2020
21+ public function testNonSquare ()
22+ {
23+ static ::setExpectedException (MatrixException::class);
24+
25+ new LUDecomposition (new Matrix ([[1 , 2 , 3 ]]));
26+ }
27+
28+ public function testSingularByZeroes ()
29+ {
30+ static ::setExpectedException (MatrixException::class);
31+
32+ new LUDecomposition (new Matrix ([
33+ [0 , 0 ],
34+ [0 , 0 ],
35+ ]));
36+ }
37+
38+ public function testWrongSizeKnowns ()
39+ {
40+ $ matrix = $ this ->buildMatrix ();
41+ $ decomp = new LUDecomposition ($ matrix );
42+
43+ static ::setExpectedException (MatrixException::class);
44+
45+ $ decomp ->solve ([1 ]);
46+ }
47+
48+ public function testSingularByDiagonal ()
49+ {
50+ static ::setExpectedException (MatrixException::class);
51+
52+ new LUDecomposition (new Matrix ([
53+ [1 , -1 , 2 ],
54+ [1 , 0 , 1 ],
55+ [2 , 3 , -1 ],
56+ ]));
57+ }
58+
2159 public function testLUDecompConstructor ()
2260 {
2361 $ matrix = $ this ->buildMatrix ();
You can’t perform that action at this time.
0 commit comments