Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
IdentityMatrix | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\Math\Matrix |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\Math\Matrix; |
16 | |
17 | /** |
18 | * Identity Matrix |
19 | * |
20 | * @package phpOMS\Math\Matrix |
21 | * @license OMS License 2.0 |
22 | * @link https://jingga.app |
23 | * @since 1.0.0 |
24 | */ |
25 | final class IdentityMatrix extends Matrix |
26 | { |
27 | /** |
28 | * Constructor. |
29 | * |
30 | * @param int<0, max> $n Matrix dimension |
31 | * |
32 | * @since 1.0.0 |
33 | */ |
34 | public function __construct(int $n) |
35 | { |
36 | parent::__construct($n, $n); |
37 | |
38 | for ($i = 0; $i < $n; ++$i) { |
39 | $this->matrix[$i][$i] = 1; |
40 | } |
41 | } |
42 | } |