@@ -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(); |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | return $ar; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * |
|
81 | - * @param int $col |
|
82 | - * @param int $dtype |
|
83 | - * @return vector |
|
84 | - */ |
|
79 | + /** |
|
80 | + * |
|
81 | + * @param int $col |
|
82 | + * @param int $dtype |
|
83 | + * @return vector |
|
84 | + */ |
|
85 | 85 | public static function zeros(int $col, int $dtype = self::FLOAT): vector { |
86 | 86 | $ar = self::factory($col, $dtype); |
87 | 87 | for ($i = 0; $i < $col; ++$i) { |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | - * create a null like vector |
|
108 | - * @param int $col |
|
109 | - * @return vector |
|
110 | - */ |
|
107 | + * create a null like vector |
|
108 | + * @param int $col |
|
109 | + * @return vector |
|
110 | + */ |
|
111 | 111 | public static function null(int $col, int $dtype = self::FLOAT): vector { |
112 | 112 | $ar = self::factory($col, $dtype); |
113 | 113 | for ($i = 0; $i < $col; ++$i) { |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | return true; |
675 | 675 | } |
676 | 676 | |
677 | - protected function checkDtype(vector $vector) { |
|
677 | + protected function checkDtype(vector $vector) { |
|
678 | 678 | if($this->dtype != $vector->dtype) { |
679 | 679 | self::_err('Mismatch Dtype of given vector'); |
680 | 680 | } |
@@ -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 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | self::init(); |
54 | 54 | if($mat->dtype == \Np\matrix::FLOAT){ |
55 | 55 | return self::$ffi_lapack->LAPACKE_sgetri($matLayout, $mat->row, $mat->data, $mat->row, $ipiv->data); |
56 | - } |
|
57 | - else { |
|
56 | + } else { |
|
58 | 57 | return self::$ffi_lapack->LAPACKE_dgetri($matLayout, $mat->row, $mat->data, $mat->row, $ipiv->data); |
59 | 58 | } |
60 | 59 | } |
@@ -138,8 +137,7 @@ discard block |
||
138 | 137 | self::init(); |
139 | 138 | if($m->dtype == \Np\matrix::FLOAT){ |
140 | 139 | return self::$ffi_lapack->LAPACKE_slange($matLayout, $norm, $m->row, $m->col, $m->data, $m->col); |
141 | - } |
|
142 | - else{ |
|
140 | + } else{ |
|
143 | 141 | return self::$ffi_lapack->LAPACKE_dlange($matLayout, $norm, $m->row, $m->col, $m->data, $m->col); |
144 | 142 | } |
145 | 143 | } |