@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @param matrix|vector $d |
| 20 | 20 | * @return matrix|vector |
| 21 | 21 | */ |
| 22 | - public function max(matrix|vector $d): matrix|vector { |
|
| 22 | + public function max(matrix | vector $d): matrix | vector { |
|
| 23 | 23 | if ($this instanceof matrix && $d instanceof matrix && $this->checkShape($this, $d) && $this->checkDtype($this, $d)) { |
| 24 | 24 | $r = self::factory($this->row, $this->col, $this->dtype); |
| 25 | 25 | } elseif ($this instanceof vector && $d instanceof vector && $this->checkShape($this, $d) && $this->checkDtype($this, $d)) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param matrix|vector $d |
| 37 | 37 | * @return matrix|vector |
| 38 | 38 | */ |
| 39 | - public function min(matrix|vector $d): matrix|vector { |
|
| 39 | + public function min(matrix | vector $d): matrix | vector { |
|
| 40 | 40 | if ($this instanceof matrix && $d instanceof matrix && $this->checkShape($this, $d) && $this->checkDtype($this, $d)) { |
| 41 | 41 | $r = self::factory($this->row, $this->col, $this->dtype); |
| 42 | 42 | } elseif ($this instanceof vector && $d instanceof vector && $this->checkShape($this, $d) && $this->checkDtype($this, $d)) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param callable $func |
| 54 | 54 | * @return matrix|vector |
| 55 | 55 | */ |
| 56 | - public function map(callable $func): matrix|vector { |
|
| 56 | + public function map(callable $func): matrix | vector { |
|
| 57 | 57 | if ($this instanceof matrix) { |
| 58 | 58 | $r = self::factory($this->row, $this->col, $this->dtype); |
| 59 | 59 | } else { |
@@ -65,23 +65,23 @@ discard block |
||
| 65 | 65 | return $r; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function abs(): matrix|vector { |
|
| 68 | + public function abs(): matrix | vector { |
|
| 69 | 69 | return $this->map('abs'); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function sqrt(): matrix|vector { |
|
| 72 | + public function sqrt(): matrix | vector { |
|
| 73 | 73 | return $this->map('sqrt'); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function exp(): matrix|vector { |
|
| 76 | + public function exp(): matrix | vector { |
|
| 77 | 77 | return $this->map('exp'); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function exp1(): matrix|vector { |
|
| 80 | + public function exp1(): matrix | vector { |
|
| 81 | 81 | return $this->map('exp1'); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function log(float $b = M_E): matrix|vector { |
|
| 84 | + public function log(float $b = M_E): matrix | vector { |
|
| 85 | 85 | $ar = $this->copy(); |
| 86 | 86 | for ($i = 0; $i < $ar->ndim; ++$i) { |
| 87 | 87 | log($ar->data[$i], $b); |
@@ -89,52 +89,52 @@ discard block |
||
| 89 | 89 | return $ar; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function log1p(): matrix|vector { |
|
| 92 | + public function log1p(): matrix | vector { |
|
| 93 | 93 | return $this->map('log1p'); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function sin(): matrix|vector { |
|
| 96 | + public function sin(): matrix | vector { |
|
| 97 | 97 | return $this->map('sin'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public function asin(): matrix|vector { |
|
| 100 | + public function asin(): matrix | vector { |
|
| 101 | 101 | return $this->map('asin'); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function cos(): matrix|vector { |
|
| 104 | + public function cos(): matrix | vector { |
|
| 105 | 105 | return $this->map('cos'); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - public function acos(): matrix|vector { |
|
| 108 | + public function acos(): matrix | vector { |
|
| 109 | 109 | return $this->map('acos'); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function tan(): matrix|vector { |
|
| 112 | + public function tan(): matrix | vector { |
|
| 113 | 113 | return $this->map('tan'); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - public function atan(): matrix|vector { |
|
| 116 | + public function atan(): matrix | vector { |
|
| 117 | 117 | return $this->map('atan'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function radToDeg(): matrix|vector { |
|
| 120 | + public function radToDeg(): matrix | vector { |
|
| 121 | 121 | return $this->map('rad2deg'); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function degToRad(): matrix|vector { |
|
| 124 | + public function degToRad(): matrix | vector { |
|
| 125 | 125 | return $this->map('deg2rad'); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function floor(): matrix|vector { |
|
| 128 | + public function floor(): matrix | vector { |
|
| 129 | 129 | return $this->map('floor'); |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function ceil(): matrix|vector { |
|
| 132 | + public function ceil(): matrix | vector { |
|
| 133 | 133 | return $this->map('ceil'); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function free():void { |
| 137 | - if($this instanceof matrix) { |
|
| 137 | + if ($this instanceof matrix) { |
|
| 138 | 138 | unset($this->row); |
| 139 | 139 | unset($this->col); |
| 140 | 140 | unset($this->ndim); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * make a copy of matrix|vector; |
| 152 | 152 | * @return matrix|vector |
| 153 | 153 | */ |
| 154 | - public function copy(): matrix|vector { |
|
| 154 | + public function copy(): matrix | vector { |
|
| 155 | 155 | return clone $this; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param float $max |
| 164 | 164 | * @return matrix |
| 165 | 165 | */ |
| 166 | - public function clip(float $min, float $max): matrix|vector { |
|
| 166 | + public function clip(float $min, float $max): matrix | vector { |
|
| 167 | 167 | if ($this instanceof matrix) { |
| 168 | 168 | $ar = self::factory($this->row, $this->col, $this->dtype); |
| 169 | 169 | } else { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @param float $min |
| 189 | 189 | * @return matrix |
| 190 | 190 | */ |
| 191 | - public function clipLower(float $min): matrix|vector { |
|
| 191 | + public function clipLower(float $min): matrix | vector { |
|
| 192 | 192 | if ($this instanceof matrix) { |
| 193 | 193 | $ar = self::factory($this->row, $this->col, $this->dtype); |
| 194 | 194 | } else { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param float $max |
| 211 | 211 | * @return matrix |
| 212 | 212 | */ |
| 213 | - public function clipUpper(float $max): matrix|vector { |
|
| 213 | + public function clipUpper(float $max): matrix | vector { |
|
| 214 | 214 | if ($this instanceof matrix) { |
| 215 | 215 | $ar = self::factory($this->row, $this->col, $this->dtype); |
| 216 | 216 | } else { |