Skip to content

Commit bf79e49

Browse files
committed
Add matrix norms unit tests.
1 parent 333d8ce commit bf79e49

File tree

2 files changed

+371
-0
lines changed

2 files changed

+371
-0
lines changed

tests/LinearAlgebra/Fixture/MatrixDataProvider.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ trait MatrixDataProvider
7373
* - dataProviderForObjectSquareMatrix
7474
* - dataProviderForComplexObjectMatrix
7575
* - dataProviderForComplexSquareObjectMatrix
76+
* - dataProviderForZeroMatrix
7677
**************************************************************************/
7778

7879
public function dataProviderForSquareMatrix(): array
@@ -7435,6 +7436,56 @@ public function dataProviderForMatrixWithWeirdNumbers(): array
74357436
];
74367437
}
74377438

7439+
/**
7440+
* Data provider for zero matrices of various sizes
7441+
* @return array
7442+
*/
7443+
public function dataProviderForZeroMatrix(): array
7444+
{
7445+
return [
7446+
// 1x1 zero matrix
7447+
[
7448+
[
7449+
[0]
7450+
]
7451+
],
7452+
// 2x2 zero matrix
7453+
[
7454+
[
7455+
[0, 0],
7456+
[0, 0],
7457+
],
7458+
],
7459+
// 3x3 zero matrix
7460+
[
7461+
[
7462+
[0, 0, 0],
7463+
[0, 0, 0],
7464+
[0, 0, 0],
7465+
],
7466+
],
7467+
// 4x4 zero matrix
7468+
[
7469+
[
7470+
[0, 0, 0, 0],
7471+
[0, 0, 0, 0],
7472+
[0, 0, 0, 0],
7473+
[0, 0, 0, 0],
7474+
],
7475+
],
7476+
// 5x5 zero matrix
7477+
[
7478+
[
7479+
[0, 0, 0, 0, 0],
7480+
[0, 0, 0, 0, 0],
7481+
[0, 0, 0, 0, 0],
7482+
[0, 0, 0, 0, 0],
7483+
[0, 0, 0, 0, 0],
7484+
],
7485+
],
7486+
];
7487+
}
7488+
74387489
public function dataProviderForBidiagonalMatrix(): \Generator
74397490
{
74407491
foreach ($this->dataProviderForUpperBidiagonalMatrix() as $matrix) {
@@ -7504,6 +7555,9 @@ public function dataProviderForSingleMatrix(): \Generator
75047555
foreach ($this->dataProviderForMatrixWithWeirdNumbers() as $matrix) {
75057556
yield $matrix;
75067557
}
7558+
foreach ($this->dataProviderForZeroMatrix() as $matrix) {
7559+
yield $matrix;
7560+
}
75077561
}
75087562

75097563
public function dataProviderForObjectMatrix(): array

0 commit comments

Comments
 (0)