@@ -21,9 +21,9 @@ |
||
21 | 21 | protected $b; |
22 | 22 | |
23 | 23 | public function setUp() : void { |
24 | - $this->a = matrix::uniform(500,500); |
|
24 | + $this->a = matrix::uniform(500, 500); |
|
25 | 25 | |
26 | - $this->b = matrix::uniform(50,50); |
|
26 | + $this->b = matrix::uniform(50, 50); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * @var \Np\matrix |
15 | 15 | */ |
16 | - protected $a,$b; |
|
16 | + protected $a, $b; |
|
17 | 17 | |
18 | 18 | public function setUp() : void { |
19 | 19 | $this->a = matrix::uniform(500, 500); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Np\benchmarks\matrix\arithmetic; |
4 | 4 | |
5 | -use Np\{matrix,vector}; |
|
5 | +use Np\{matrix, vector}; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @Groups({"Arithmetic"}) |
@@ -26,8 +26,10 @@ |
||
26 | 26 | $lead = 0; |
27 | 27 | $ar = $m->copyMatrix(); |
28 | 28 | for ($r = 0; $r < $ar->row; ++$r) { |
29 | - if ($lead >= $ar->col) |
|
30 | - break; { |
|
29 | + if ($lead >= $ar->col) { |
|
30 | + break; |
|
31 | + } |
|
32 | + { |
|
31 | 33 | $i = $r; |
32 | 34 | while ($ar->data[$i * $ar->col + $lead] == 0) { |
33 | 35 | $i++; |
@@ -19,11 +19,11 @@ |
||
19 | 19 | |
20 | 20 | class ref { |
21 | 21 | |
22 | - /** |
|
23 | - * |
|
24 | - * @param \Np\matrix $m |
|
25 | - * @return matrix|null |
|
26 | - */ |
|
22 | + /** |
|
23 | + * |
|
24 | + * @param \Np\matrix $m |
|
25 | + * @return matrix|null |
|
26 | + */ |
|
27 | 27 | public static function factory(\Np\matrix $m): matrix|null { |
28 | 28 | $ipiv = vector::factory(min($m->row, $m->col), vector::INT); |
29 | 29 | $ar = $m->copyMatrix(); |
@@ -24,10 +24,10 @@ |
||
24 | 24 | * @param \Np\matrix $m |
25 | 25 | * @return matrix|null |
26 | 26 | */ |
27 | - public static function factory(\Np\matrix $m): matrix|null { |
|
27 | + public static function factory(\Np\matrix $m): matrix | null { |
|
28 | 28 | $ipiv = vector::factory(min($m->row, $m->col), vector::INT); |
29 | 29 | $ar = $m->copyMatrix(); |
30 | - if($m->dtype == matrix::FLOAT) { |
|
30 | + if ($m->dtype == matrix::FLOAT) { |
|
31 | 31 | $lp = lapack::sgetrf($ar, $ipiv); |
32 | 32 | if ($lp != 0) { |
33 | 33 | return null; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare (strict_types=1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Np\decompositions; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare (strict_types=1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | namespace Np\decompositions; |
6 | 6 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return matrix|null |
29 | 29 | * @throws RuntimeException |
30 | 30 | */ |
31 | - public static function factory(matrix $m): matrix|null { |
|
31 | + public static function factory(matrix $m): matrix | null { |
|
32 | 32 | if ($m->isSquare()) { |
33 | 33 | $ar = $m->copyMatrix(); |
34 | 34 | $lp = lapack::potrf($ar); |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $r->data[$i] = $sigma; |
29 | 29 | } |
30 | 30 | return $r; |
31 | - } |
|
32 | - else { |
|
31 | + } else { |
|
33 | 32 | throw new \Exception('Err::given vectors has diffrent data type!'); |
34 | 33 | } |
35 | 34 | } |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | } |
71 | 70 | } |
72 | 71 | return $rc; |
73 | - } |
|
74 | - else { |
|
72 | + } else { |
|
75 | 73 | throw new \Exception('Err::given matrixes has different data type!'); |
76 | 74 | } |
77 | 75 | } |
@@ -439,7 +439,7 @@ |
||
439 | 439 | * @param \Np\vector|\Np\matrix $v |
440 | 440 | * @return type |
441 | 441 | */ |
442 | - public static function scale(float $alpha, \Np\vector|\Np\matrix $v) { |
|
442 | + public static function scale(float $alpha, \Np\vector | \Np\matrix $v) { |
|
443 | 443 | self::init(); |
444 | 444 | if ($v->dtype == \Np\vector::DOUBLE) { |
445 | 445 | return self::$ffi_blas->cblas_dscal($v->ndim, $alpha, $v->data, 1); |