Completed
Push — develop ( bf3457...467bab )
by
unknown
09:08
created
src/PhpSpreadsheet/Calculation/Logical.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,8 +248,8 @@
 block discarded – undo
248 248
      */
249 249
     public static function statementIf($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
250 250
     {
251
-        $condition     = (is_null($condition))     ? true :  (boolean) Functions::flattenSingleValue($condition);
252
-        $returnIfTrue  = (is_null($returnIfTrue))  ? 0 :     Functions::flattenSingleValue($returnIfTrue);
251
+        $condition     = (is_null($condition)) ? true : (boolean) Functions::flattenSingleValue($condition);
252
+        $returnIfTrue  = (is_null($returnIfTrue)) ? 0 : Functions::flattenSingleValue($returnIfTrue);
253 253
         $returnIfFalse = (is_null($returnIfFalse)) ? false : Functions::flattenSingleValue($returnIfFalse);
254 254
 
255 255
         return ($condition) ? $returnIfTrue : $returnIfFalse;
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/TimeZone.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * @private
36 36
      * @var    string
37 37
      */
38
-    protected static $timezone    = 'UTC';
38
+    protected static $timezone = 'UTC';
39 39
 
40 40
     /**
41 41
      * Validate a Timezone name
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/CodePage.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -41,117 +41,117 @@
 block discarded – undo
41 41
     {
42 42
         switch ($codePage) {
43 43
             case 367:
44
-                return 'ASCII';    //    ASCII
44
+                return 'ASCII'; //    ASCII
45 45
             case 437:
46
-                return 'CP437';    //    OEM US
46
+                return 'CP437'; //    OEM US
47 47
             case 720:
48
-                throw new \PHPExcel\Exception('Code page 720 not supported.');    //    OEM Arabic
48
+                throw new \PHPExcel\Exception('Code page 720 not supported.'); //    OEM Arabic
49 49
             case 737:
50
-                return 'CP737';    //    OEM Greek
50
+                return 'CP737'; //    OEM Greek
51 51
             case 775:
52
-                return 'CP775';    //    OEM Baltic
52
+                return 'CP775'; //    OEM Baltic
53 53
             case 850:
54
-                return 'CP850';    //    OEM Latin I
54
+                return 'CP850'; //    OEM Latin I
55 55
             case 852:
56
-                return 'CP852';    //    OEM Latin II (Central European)
56
+                return 'CP852'; //    OEM Latin II (Central European)
57 57
             case 855:
58
-                return 'CP855';    //    OEM Cyrillic
58
+                return 'CP855'; //    OEM Cyrillic
59 59
             case 857:
60
-                return 'CP857';    //    OEM Turkish
60
+                return 'CP857'; //    OEM Turkish
61 61
             case 858:
62
-                return 'CP858';    //    OEM Multilingual Latin I with Euro
62
+                return 'CP858'; //    OEM Multilingual Latin I with Euro
63 63
             case 860:
64
-                return 'CP860';    //    OEM Portugese
64
+                return 'CP860'; //    OEM Portugese
65 65
             case 861:
66
-                return 'CP861';    //    OEM Icelandic
66
+                return 'CP861'; //    OEM Icelandic
67 67
             case 862:
68
-                return 'CP862';    //    OEM Hebrew
68
+                return 'CP862'; //    OEM Hebrew
69 69
             case 863:
70
-                return 'CP863';    //    OEM Canadian (French)
70
+                return 'CP863'; //    OEM Canadian (French)
71 71
             case 864:
72
-                return 'CP864';    //    OEM Arabic
72
+                return 'CP864'; //    OEM Arabic
73 73
             case 865:
74
-                return 'CP865';    //    OEM Nordic
74
+                return 'CP865'; //    OEM Nordic
75 75
             case 866:
76
-                return 'CP866';    //    OEM Cyrillic (Russian)
76
+                return 'CP866'; //    OEM Cyrillic (Russian)
77 77
             case 869:
78
-                return 'CP869';    //    OEM Greek (Modern)
78
+                return 'CP869'; //    OEM Greek (Modern)
79 79
             case 874:
80
-                return 'CP874';    //    ANSI Thai
80
+                return 'CP874'; //    ANSI Thai
81 81
             case 932:
82
-                return 'CP932';    //    ANSI Japanese Shift-JIS
82
+                return 'CP932'; //    ANSI Japanese Shift-JIS
83 83
             case 936:
84
-                return 'CP936';    //    ANSI Chinese Simplified GBK
84
+                return 'CP936'; //    ANSI Chinese Simplified GBK
85 85
             case 949:
86
-                return 'CP949';    //    ANSI Korean (Wansung)
86
+                return 'CP949'; //    ANSI Korean (Wansung)
87 87
             case 950:
88
-                return 'CP950';    //    ANSI Chinese Traditional BIG5
88
+                return 'CP950'; //    ANSI Chinese Traditional BIG5
89 89
             case 1200:
90 90
                 return 'UTF-16LE'; //    UTF-16 (BIFF8)
91 91
             case 1250:
92
-                return 'CP1250';   //    ANSI Latin II (Central European)
92
+                return 'CP1250'; //    ANSI Latin II (Central European)
93 93
             case 1251:
94
-                return 'CP1251';   //    ANSI Cyrillic
94
+                return 'CP1251'; //    ANSI Cyrillic
95 95
             case 0:
96 96
                 //    CodePage is not always correctly set when the xls file was saved by Apple's Numbers program
97 97
             case 1252:
98
-                return 'CP1252';   //    ANSI Latin I (BIFF4-BIFF7)
98
+                return 'CP1252'; //    ANSI Latin I (BIFF4-BIFF7)
99 99
             case 1253:
100
-                return 'CP1253';   //    ANSI Greek
100
+                return 'CP1253'; //    ANSI Greek
101 101
             case 1254:
102
-                return 'CP1254';   //    ANSI Turkish
102
+                return 'CP1254'; //    ANSI Turkish
103 103
             case 1255:
104
-                return 'CP1255';   //    ANSI Hebrew
104
+                return 'CP1255'; //    ANSI Hebrew
105 105
             case 1256:
106
-                return 'CP1256';   //    ANSI Arabic
106
+                return 'CP1256'; //    ANSI Arabic
107 107
             case 1257:
108
-                return 'CP1257';   //    ANSI Baltic
108
+                return 'CP1257'; //    ANSI Baltic
109 109
             case 1258:
110
-                return 'CP1258';   //    ANSI Vietnamese
110
+                return 'CP1258'; //    ANSI Vietnamese
111 111
             case 1361:
112
-                return 'CP1361';   //    ANSI Korean (Johab)
112
+                return 'CP1361'; //    ANSI Korean (Johab)
113 113
             case 10000:
114
-                return 'MAC';      //    Apple Roman
114
+                return 'MAC'; //    Apple Roman
115 115
             case 10001:
116
-                return 'CP932';    //    Macintosh Japanese
116
+                return 'CP932'; //    Macintosh Japanese
117 117
             case 10002:
118
-                return 'CP950';    //    Macintosh Chinese Traditional
118
+                return 'CP950'; //    Macintosh Chinese Traditional
119 119
             case 10003:
120
-                return 'CP1361';   //    Macintosh Korean
120
+                return 'CP1361'; //    Macintosh Korean
121 121
             case 10004:
122 122
                 return 'MACARABIC'; //    Apple Arabic
123 123
             case 10005:
124 124
                 return 'MACHEBREW'; //    Apple Hebrew
125 125
             case 10006:
126
-                return 'MACGREEK';  //    Macintosh Greek
126
+                return 'MACGREEK'; //    Macintosh Greek
127 127
             case 10007:
128
-                return 'MACCYRILLIC';  //    Macintosh Cyrillic
128
+                return 'MACCYRILLIC'; //    Macintosh Cyrillic
129 129
             case 10008:
130
-                return 'CP936';  //    Macintosh - Simplified Chinese (GB 2312)
130
+                return 'CP936'; //    Macintosh - Simplified Chinese (GB 2312)
131 131
             case 10010:
132
-                return 'MACROMANIA';    //    Macintosh Romania
132
+                return 'MACROMANIA'; //    Macintosh Romania
133 133
             case 10017:
134
-                return 'MACUKRAINE';    //    Macintosh Ukraine
134
+                return 'MACUKRAINE'; //    Macintosh Ukraine
135 135
             case 10021:
136
-                return 'MACTHAI';    //    Macintosh Thai
136
+                return 'MACTHAI'; //    Macintosh Thai
137 137
             case 10029:
138
-                return 'MACCENTRALEUROPE';  //    Macintosh Central Europe
138
+                return 'MACCENTRALEUROPE'; //    Macintosh Central Europe
139 139
             case 10079:
140
-                return 'MACICELAND';  //    Macintosh Icelandic
140
+                return 'MACICELAND'; //    Macintosh Icelandic
141 141
             case 10081:
142
-                return 'MACTURKISH';  //    Macintosh Turkish
142
+                return 'MACTURKISH'; //    Macintosh Turkish
143 143
             case 10082:
144
-                return 'MACCROATIAN';    //    Macintosh Croatian
144
+                return 'MACCROATIAN'; //    Macintosh Croatian
145 145
             case 21010:
146
-                return 'UTF-16LE';  //    UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE
146
+                return 'UTF-16LE'; //    UTF-16 (BIFF8) This isn't correct, but some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE
147 147
             case 32768:
148
-                return 'MAC';      //    Apple Roman
148
+                return 'MAC'; //    Apple Roman
149 149
             case 32769:
150
-                throw new \PHPExcel\Exception('Code page 32769 not supported.');  //    ANSI Latin I (BIFF2-BIFF3)
150
+                throw new \PHPExcel\Exception('Code page 32769 not supported.'); //    ANSI Latin I (BIFF2-BIFF3)
151 151
             case 65000:
152
-                return 'UTF-7';    //    Unicode (UTF-7)
152
+                return 'UTF-7'; //    Unicode (UTF-7)
153 153
             case 65001:
154
-                return 'UTF-8';    //    Unicode (UTF-8)
154
+                return 'UTF-8'; //    Unicode (UTF-8)
155 155
         }
156 156
         throw new \PHPExcel\Exception('Unknown codepage: ' . $codePage);
157 157
     }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/EigenvalueDecomposition.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
         //  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
82 82
         //  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
83 83
         //  Fortran subroutine in EISPACK.
84
-        $this->d = $this->V[$this->n-1];
84
+        $this->d = $this->V[$this->n - 1];
85 85
         // Householder reduction to tridiagonal form.
86
-        for ($i = $this->n-1; $i > 0; --$i) {
87
-            $i_ = $i -1;
86
+        for ($i = $this->n - 1; $i > 0; --$i) {
87
+            $i_ = $i - 1;
88 88
             // Scale to avoid under/overflow.
89 89
             $h = $scale = 0.0;
90 90
             $scale += array_sum(array_map(abs, $this->d));
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
                     $f = $this->d[$j];
117 117
                     $this->V[$j][$i] = $f;
118 118
                     $g = $this->e[$j] + $this->V[$j][$j] * $f;
119
-                    for ($k = $j+1; $k <= $i_; ++$k) {
119
+                    for ($k = $j + 1; $k <= $i_; ++$k) {
120 120
                         $g += $this->V[$k][$j] * $this->d[$k];
121 121
                         $this->e[$k] += $this->V[$k][$j] * $f;
122 122
                     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                     $f += $this->e[$j] * $this->d[$j];
129 129
                 }
130 130
                 $hh = $f / (2 * $h);
131
-                for ($j=0; $j < $i; ++$j) {
131
+                for ($j = 0; $j < $i; ++$j) {
132 132
                     $this->e[$j] -= $hh * $this->d[$j];
133 133
                 }
134 134
                 for ($j = 0; $j < $i; ++$j) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                     for ($k = $j; $k <= $i_; ++$k) {
138 138
                         $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]);
139 139
                     }
140
-                    $this->d[$j] = $this->V[$i-1][$j];
140
+                    $this->d[$j] = $this->V[$i - 1][$j];
141 141
                     $this->V[$i][$j] = 0.0;
142 142
                 }
143 143
             }
@@ -145,18 +145,18 @@  discard block
 block discarded – undo
145 145
         }
146 146
 
147 147
         // Accumulate transformations.
148
-        for ($i = 0; $i < $this->n-1; ++$i) {
149
-            $this->V[$this->n-1][$i] = $this->V[$i][$i];
148
+        for ($i = 0; $i < $this->n - 1; ++$i) {
149
+            $this->V[$this->n - 1][$i] = $this->V[$i][$i];
150 150
             $this->V[$i][$i] = 1.0;
151
-            $h = $this->d[$i+1];
151
+            $h = $this->d[$i + 1];
152 152
             if ($h != 0.0) {
153 153
                 for ($k = 0; $k <= $i; ++$k) {
154
-                    $this->d[$k] = $this->V[$k][$i+1] / $h;
154
+                    $this->d[$k] = $this->V[$k][$i + 1] / $h;
155 155
                 }
156 156
                 for ($j = 0; $j <= $i; ++$j) {
157 157
                     $g = 0.0;
158 158
                     for ($k = 0; $k <= $i; ++$k) {
159
-                        $g += $this->V[$k][$i+1] * $this->V[$k][$j];
159
+                        $g += $this->V[$k][$i + 1] * $this->V[$k][$j];
160 160
                     }
161 161
                     for ($k = 0; $k <= $i; ++$k) {
162 162
                         $this->V[$k][$j] -= $g * $this->d[$k];
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
                 }
165 165
             }
166 166
             for ($k = 0; $k <= $i; ++$k) {
167
-                $this->V[$k][$i+1] = 0.0;
167
+                $this->V[$k][$i + 1] = 0.0;
168 168
             }
169 169
         }
170 170
 
171
-        $this->d = $this->V[$this->n-1];
172
-        $this->V[$this->n-1] = array_fill(0, $j, 0.0);
173
-        $this->V[$this->n-1][$this->n-1] = 1.0;
171
+        $this->d = $this->V[$this->n - 1];
172
+        $this->V[$this->n - 1] = array_fill(0, $j, 0.0);
173
+        $this->V[$this->n - 1][$this->n - 1] = 1.0;
174 174
         $this->e[0] = 0.0;
175 175
     }
176 176
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     private function tql2()
188 188
     {
189 189
         for ($i = 1; $i < $this->n; ++$i) {
190
-            $this->e[$i-1] = $this->e[$i];
190
+            $this->e[$i - 1] = $this->e[$i];
191 191
         }
192
-        $this->e[$this->n-1] = 0.0;
192
+        $this->e[$this->n - 1] = 0.0;
193 193
         $f = 0.0;
194 194
         $tst1 = 0.0;
195 195
         $eps  = pow(2.0, -52.0);
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
                     $iter += 1;
214 214
                     // Compute implicit shift
215 215
                     $g = $this->d[$l];
216
-                    $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
216
+                    $p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]);
217 217
                     $r = hypo($p, 1.0);
218 218
                     if ($p < 0) {
219 219
                         $r *= -1;
220 220
                     }
221 221
                     $this->d[$l] = $this->e[$l] / ($p + $r);
222
-                    $this->d[$l+1] = $this->e[$l] * ($p + $r);
223
-                    $dl1 = $this->d[$l+1];
222
+                    $this->d[$l + 1] = $this->e[$l] * ($p + $r);
223
+                    $dl1 = $this->d[$l + 1];
224 224
                     $h = $g - $this->d[$l];
225 225
                     for ($i = $l + 2; $i < $this->n; ++$i) {
226 226
                         $this->d[$i] -= $h;
@@ -232,22 +232,22 @@  discard block
 block discarded – undo
232 232
                     $c2 = $c3 = $c;
233 233
                     $el1 = $this->e[$l + 1];
234 234
                     $s = $s2 = 0.0;
235
-                    for ($i = $m-1; $i >= $l; --$i) {
235
+                    for ($i = $m - 1; $i >= $l; --$i) {
236 236
                         $c3 = $c2;
237 237
                         $c2 = $c;
238 238
                         $s2 = $s;
239 239
                         $g  = $c * $this->e[$i];
240 240
                         $h  = $c * $p;
241 241
                         $r  = hypo($p, $this->e[$i]);
242
-                        $this->e[$i+1] = $s * $r;
242
+                        $this->e[$i + 1] = $s * $r;
243 243
                         $s = $this->e[$i] / $r;
244 244
                         $c = $p / $r;
245 245
                         $p = $c * $this->d[$i] - $s * $g;
246
-                        $this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]);
246
+                        $this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]);
247 247
                         // Accumulate transformation.
248 248
                         for ($k = 0; $k < $this->n; ++$k) {
249
-                            $h = $this->V[$k][$i+1];
250
-                            $this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h;
249
+                            $h = $this->V[$k][$i + 1];
250
+                            $this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h;
251 251
                             $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
252 252
                         }
253 253
                     }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         for ($i = 0; $i < $this->n - 1; ++$i) {
266 266
             $k = $i;
267 267
             $p = $this->d[$i];
268
-            for ($j = $i+1; $j < $this->n; ++$j) {
268
+            for ($j = $i + 1; $j < $this->n; ++$j) {
269 269
                 if ($this->d[$j] < $p) {
270 270
                     $k = $j;
271 271
                     $p = $this->d[$j];
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
     private function orthes()
297 297
     {
298 298
         $low  = 0;
299
-        $high = $this->n-1;
299
+        $high = $this->n - 1;
300 300
 
301
-        for ($m = $low+1; $m <= $high-1; ++$m) {
301
+        for ($m = $low + 1; $m <= $high - 1; ++$m) {
302 302
             // Scale column.
303 303
             $scale = 0.0;
304 304
             for ($i = $m; $i <= $high; ++$i) {
305
-                $scale = $scale + abs($this->H[$i][$m-1]);
305
+                $scale = $scale + abs($this->H[$i][$m - 1]);
306 306
             }
307 307
             if ($scale != 0.0) {
308 308
                 // Compute Householder transformation.
309 309
                 $h = 0.0;
310 310
                 for ($i = $high; $i >= $m; --$i) {
311
-                    $this->ort[$i] = $this->H[$i][$m-1] / $scale;
311
+                    $this->ort[$i] = $this->H[$i][$m - 1] / $scale;
312 312
                     $h += $this->ort[$i] * $this->ort[$i];
313 313
                 }
314 314
                 $g = sqrt($h);
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                     }
341 341
                 }
342 342
                 $this->ort[$m] = $scale * $this->ort[$m];
343
-                $this->H[$m][$m-1] = $scale * $g;
343
+                $this->H[$m][$m - 1] = $scale * $g;
344 344
             }
345 345
         }
346 346
 
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
                 $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0);
351 351
             }
352 352
         }
353
-        for ($m = $high-1; $m >= $low+1; --$m) {
354
-            if ($this->H[$m][$m-1] != 0.0) {
355
-                for ($i = $m+1; $i <= $high; ++$i) {
356
-                    $this->ort[$i] = $this->H[$i][$m-1];
353
+        for ($m = $high - 1; $m >= $low + 1; --$m) {
354
+            if ($this->H[$m][$m - 1] != 0.0) {
355
+                for ($i = $m + 1; $i <= $high; ++$i) {
356
+                    $this->ort[$i] = $this->H[$i][$m - 1];
357 357
                 }
358 358
                 for ($j = $m; $j <= $high; ++$j) {
359 359
                     $g = 0.0;
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                         $g += $this->ort[$i] * $this->V[$i][$j];
362 362
                     }
363 363
                     // Double division avoids possible underflow
364
-                    $g = ($g / $this->ort[$m]) / $this->H[$m][$m-1];
364
+                    $g = ($g / $this->ort[$m]) / $this->H[$m][$m - 1];
365 365
                     for ($i = $m; $i <= $high; ++$i) {
366 366
                         $this->V[$i][$j] += $g * $this->ort[$i];
367 367
                     }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                 $this->d[$i] = $this->H[$i][$i];
419 419
                 $this->e[$i] = 0.0;
420 420
             }
421
-            for ($j = max($i-1, 0); $j < $nn; ++$j) {
421
+            for ($j = max($i - 1, 0); $j < $nn; ++$j) {
422 422
                 $norm = $norm + abs($this->H[$i][$j]);
423 423
             }
424 424
         }
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
             // Look for single small sub-diagonal element
430 430
             $l = $n;
431 431
             while ($l > $low) {
432
-                $s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]);
432
+                $s = abs($this->H[$l - 1][$l - 1]) + abs($this->H[$l][$l]);
433 433
                 if ($s == 0.0) {
434 434
                     $s = $norm;
435 435
                 }
436
-                if (abs($this->H[$l][$l-1]) < $eps * $s) {
436
+                if (abs($this->H[$l][$l - 1]) < $eps * $s) {
437 437
                     break;
438 438
                 }
439 439
                 --$l;
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
                 --$n;
448 448
                 $iter = 0;
449 449
             // Two roots found
450
-            } elseif ($l == $n-1) {
451
-                $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
452
-                $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
450
+            } elseif ($l == $n - 1) {
451
+                $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
452
+                $p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0;
453 453
                 $q = $p * $p + $w;
454 454
                 $z = sqrt(abs($q));
455 455
                 $this->H[$n][$n] = $this->H[$n][$n] + $exshift;
456
-                $this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift;
456
+                $this->H[$n - 1][$n - 1] = $this->H[$n - 1][$n - 1] + $exshift;
457 457
                 $x = $this->H[$n][$n];
458 458
                 // Real pair
459 459
                 if ($q >= 0) {
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
                     } else {
463 463
                         $z = $p - $z;
464 464
                     }
465
-                    $this->d[$n-1] = $x + $z;
466
-                    $this->d[$n] = $this->d[$n-1];
465
+                    $this->d[$n - 1] = $x + $z;
466
+                    $this->d[$n] = $this->d[$n - 1];
467 467
                     if ($z != 0.0) {
468 468
                         $this->d[$n] = $x - $w / $z;
469 469
                     }
470
-                    $this->e[$n-1] = 0.0;
470
+                    $this->e[$n - 1] = 0.0;
471 471
                     $this->e[$n] = 0.0;
472
-                    $x = $this->H[$n][$n-1];
472
+                    $x = $this->H[$n][$n - 1];
473 473
                     $s = abs($x) + abs($z);
474 474
                     $p = $x / $s;
475 475
                     $q = $z / $s;
@@ -477,28 +477,28 @@  discard block
 block discarded – undo
477 477
                     $p = $p / $r;
478 478
                     $q = $q / $r;
479 479
                     // Row modification
480
-                    for ($j = $n-1; $j < $nn; ++$j) {
481
-                        $z = $this->H[$n-1][$j];
482
-                        $this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j];
480
+                    for ($j = $n - 1; $j < $nn; ++$j) {
481
+                        $z = $this->H[$n - 1][$j];
482
+                        $this->H[$n - 1][$j] = $q * $z + $p * $this->H[$n][$j];
483 483
                         $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
484 484
                     }
485 485
                     // Column modification
486 486
                     for ($i = 0; $i <= $n; ++$i) {
487
-                        $z = $this->H[$i][$n-1];
488
-                        $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
487
+                        $z = $this->H[$i][$n - 1];
488
+                        $this->H[$i][$n - 1] = $q * $z + $p * $this->H[$i][$n];
489 489
                         $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
490 490
                     }
491 491
                     // Accumulate transformations
492 492
                     for ($i = $low; $i <= $high; ++$i) {
493
-                        $z = $this->V[$i][$n-1];
494
-                        $this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n];
493
+                        $z = $this->V[$i][$n - 1];
494
+                        $this->V[$i][$n - 1] = $q * $z + $p * $this->V[$i][$n];
495 495
                         $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z;
496 496
                     }
497 497
                 // Complex pair
498 498
                 } else {
499
-                    $this->d[$n-1] = $x + $p;
499
+                    $this->d[$n - 1] = $x + $p;
500 500
                     $this->d[$n] = $x + $p;
501
-                    $this->e[$n-1] = $z;
501
+                    $this->e[$n - 1] = $z;
502 502
                     $this->e[$n] = -$z;
503 503
                 }
504 504
                 $n = $n - 2;
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
                 $y = 0.0;
511 511
                 $w = 0.0;
512 512
                 if ($l < $n) {
513
-                    $y = $this->H[$n-1][$n-1];
514
-                    $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
513
+                    $y = $this->H[$n - 1][$n - 1];
514
+                    $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
515 515
                 }
516 516
                 // Wilkinson's original ad hoc shift
517 517
                 if ($iter == 10) {
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                     for ($i = $low; $i <= $n; ++$i) {
520 520
                         $this->H[$i][$i] -= $x;
521 521
                     }
522
-                    $s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]);
522
+                    $s = abs($this->H[$n][$n - 1]) + abs($this->H[$n - 1][$n - 2]);
523 523
                     $x = $y = 0.75 * $s;
524 524
                     $w = -0.4375 * $s * $s;
525 525
                 }
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
                     $z = $this->H[$m][$m];
549 549
                     $r = $x - $z;
550 550
                     $s = $y - $z;
551
-                    $p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1];
552
-                    $q = $this->H[$m+1][$m+1] - $z - $r - $s;
553
-                    $r = $this->H[$m+2][$m+1];
551
+                    $p = ($r * $s - $w) / $this->H[$m + 1][$m] + $this->H[$m][$m + 1];
552
+                    $q = $this->H[$m + 1][$m + 1] - $z - $r - $s;
553
+                    $r = $this->H[$m + 2][$m + 1];
554 554
                     $s = abs($p) + abs($q) + abs($r);
555 555
                     $p = $p / $s;
556 556
                     $q = $q / $s;
@@ -558,25 +558,25 @@  discard block
 block discarded – undo
558 558
                     if ($m == $l) {
559 559
                         break;
560 560
                     }
561
-                    if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) <
562
-                        $eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) {
561
+                    if (abs($this->H[$m][$m - 1]) * (abs($q) + abs($r)) <
562
+                        $eps * (abs($p) * (abs($this->H[$m - 1][$m - 1]) + abs($z) + abs($this->H[$m + 1][$m + 1])))) {
563 563
                         break;
564 564
                     }
565 565
                     --$m;
566 566
                 }
567 567
                 for ($i = $m + 2; $i <= $n; ++$i) {
568
-                    $this->H[$i][$i-2] = 0.0;
569
-                    if ($i > $m+2) {
570
-                        $this->H[$i][$i-3] = 0.0;
568
+                    $this->H[$i][$i - 2] = 0.0;
569
+                    if ($i > $m + 2) {
570
+                        $this->H[$i][$i - 3] = 0.0;
571 571
                     }
572 572
                 }
573 573
                 // Double QR step involving rows l:n and columns m:n
574
-                for ($k = $m; $k <= $n-1; ++$k) {
575
-                    $notlast = ($k != $n-1);
574
+                for ($k = $m; $k <= $n - 1; ++$k) {
575
+                    $notlast = ($k != $n - 1);
576 576
                     if ($k != $m) {
577
-                        $p = $this->H[$k][$k-1];
578
-                        $q = $this->H[$k+1][$k-1];
579
-                        $r = ($notlast ? $this->H[$k+2][$k-1] : 0.0);
577
+                        $p = $this->H[$k][$k - 1];
578
+                        $q = $this->H[$k + 1][$k - 1];
579
+                        $r = ($notlast ? $this->H[$k + 2][$k - 1] : 0.0);
580 580
                         $x = abs($p) + abs($q) + abs($r);
581 581
                         if ($x != 0.0) {
582 582
                             $p = $p / $x;
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
                     }
594 594
                     if ($s != 0) {
595 595
                         if ($k != $m) {
596
-                            $this->H[$k][$k-1] = -$s * $x;
596
+                            $this->H[$k][$k - 1] = -$s * $x;
597 597
                         } elseif ($l != $m) {
598
-                            $this->H[$k][$k-1] = -$this->H[$k][$k-1];
598
+                            $this->H[$k][$k - 1] = -$this->H[$k][$k - 1];
599 599
                         }
600 600
                         $p = $p + $s;
601 601
                         $x = $p / $s;
@@ -605,33 +605,33 @@  discard block
 block discarded – undo
605 605
                         $r = $r / $p;
606 606
                         // Row modification
607 607
                         for ($j = $k; $j < $nn; ++$j) {
608
-                            $p = $this->H[$k][$j] + $q * $this->H[$k+1][$j];
608
+                            $p = $this->H[$k][$j] + $q * $this->H[$k + 1][$j];
609 609
                             if ($notlast) {
610
-                                $p = $p + $r * $this->H[$k+2][$j];
611
-                                $this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z;
610
+                                $p = $p + $r * $this->H[$k + 2][$j];
611
+                                $this->H[$k + 2][$j] = $this->H[$k + 2][$j] - $p * $z;
612 612
                             }
613 613
                             $this->H[$k][$j] = $this->H[$k][$j] - $p * $x;
614
-                            $this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y;
614
+                            $this->H[$k + 1][$j] = $this->H[$k + 1][$j] - $p * $y;
615 615
                         }
616 616
                         // Column modification
617
-                        for ($i = 0; $i <= min($n, $k+3); ++$i) {
618
-                            $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1];
617
+                        for ($i = 0; $i <= min($n, $k + 3); ++$i) {
618
+                            $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k + 1];
619 619
                             if ($notlast) {
620
-                                $p = $p + $z * $this->H[$i][$k+2];
621
-                                $this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r;
620
+                                $p = $p + $z * $this->H[$i][$k + 2];
621
+                                $this->H[$i][$k + 2] = $this->H[$i][$k + 2] - $p * $r;
622 622
                             }
623 623
                             $this->H[$i][$k] = $this->H[$i][$k] - $p;
624
-                            $this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q;
624
+                            $this->H[$i][$k + 1] = $this->H[$i][$k + 1] - $p * $q;
625 625
                         }
626 626
                         // Accumulate transformations
627 627
                         for ($i = $low; $i <= $high; ++$i) {
628
-                            $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1];
628
+                            $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k + 1];
629 629
                             if ($notlast) {
630
-                                $p = $p + $z * $this->V[$i][$k+2];
631
-                                $this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r;
630
+                                $p = $p + $z * $this->V[$i][$k + 2];
631
+                                $this->V[$i][$k + 2] = $this->V[$i][$k + 2] - $p * $r;
632 632
                             }
633 633
                             $this->V[$i][$k] = $this->V[$i][$k] - $p;
634
-                            $this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q;
634
+                            $this->V[$i][$k + 1] = $this->V[$i][$k + 1] - $p * $q;
635 635
                         }
636 636
                     }  // ($s != 0)
637 637
                 }  // k loop
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
             return;
644 644
         }
645 645
 
646
-        for ($n = $nn-1; $n >= 0; --$n) {
646
+        for ($n = $nn - 1; $n >= 0; --$n) {
647 647
             $p = $this->d[$n];
648 648
             $q = $this->e[$n];
649 649
             // Real vector
650 650
             if ($q == 0) {
651 651
                 $l = $n;
652 652
                 $this->H[$n][$n] = 1.0;
653
-                for ($i = $n-1; $i >= 0; --$i) {
653
+                for ($i = $n - 1; $i >= 0; --$i) {
654 654
                     $w = $this->H[$i][$i] - $p;
655 655
                     $r = 0.0;
656 656
                     for ($j = $l; $j <= $n; ++$j) {
@@ -669,15 +669,15 @@  discard block
 block discarded – undo
669 669
                             }
670 670
                         // Solve real equations
671 671
                         } else {
672
-                            $x = $this->H[$i][$i+1];
673
-                            $y = $this->H[$i+1][$i];
672
+                            $x = $this->H[$i][$i + 1];
673
+                            $y = $this->H[$i + 1][$i];
674 674
                             $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i];
675 675
                             $t = ($x * $s - $z * $r) / $q;
676 676
                             $this->H[$i][$n] = $t;
677 677
                             if (abs($x) > abs($z)) {
678
-                                $this->H[$i+1][$n] = (-$r - $w * $t) / $x;
678
+                                $this->H[$i + 1][$n] = (-$r - $w * $t) / $x;
679 679
                             } else {
680
-                                $this->H[$i+1][$n] = (-$s - $y * $t) / $z;
680
+                                $this->H[$i + 1][$n] = (-$s - $y * $t) / $z;
681 681
                             }
682 682
                         }
683 683
                         // Overflow control
@@ -691,24 +691,24 @@  discard block
 block discarded – undo
691 691
                 }
692 692
             // Complex vector
693 693
             } elseif ($q < 0) {
694
-                $l = $n-1;
694
+                $l = $n - 1;
695 695
                 // Last vector component imaginary so matrix is triangular
696
-                if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
697
-                    $this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1];
698
-                    $this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1];
696
+                if (abs($this->H[$n][$n - 1]) > abs($this->H[$n - 1][$n])) {
697
+                    $this->H[$n - 1][$n - 1] = $q / $this->H[$n][$n - 1];
698
+                    $this->H[$n - 1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n - 1];
699 699
                 } else {
700
-                    $this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q);
701
-                    $this->H[$n-1][$n-1] = $this->cdivr;
702
-                    $this->H[$n-1][$n]   = $this->cdivi;
700
+                    $this->cdiv(0.0, -$this->H[$n - 1][$n], $this->H[$n - 1][$n - 1] - $p, $q);
701
+                    $this->H[$n - 1][$n - 1] = $this->cdivr;
702
+                    $this->H[$n - 1][$n]   = $this->cdivi;
703 703
                 }
704
-                $this->H[$n][$n-1] = 0.0;
704
+                $this->H[$n][$n - 1] = 0.0;
705 705
                 $this->H[$n][$n] = 1.0;
706
-                for ($i = $n-2; $i >= 0; --$i) {
706
+                for ($i = $n - 2; $i >= 0; --$i) {
707 707
                     // double ra,sa,vr,vi;
708 708
                     $ra = 0.0;
709 709
                     $sa = 0.0;
710 710
                     for ($j = $l; $j <= $n; ++$j) {
711
-                        $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1];
711
+                        $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n - 1];
712 712
                         $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n];
713 713
                     }
714 714
                     $w = $this->H[$i][$i] - $p;
@@ -720,34 +720,34 @@  discard block
 block discarded – undo
720 720
                         $l = $i;
721 721
                         if ($this->e[$i] == 0) {
722 722
                             $this->cdiv(-$ra, -$sa, $w, $q);
723
-                            $this->H[$i][$n-1] = $this->cdivr;
723
+                            $this->H[$i][$n - 1] = $this->cdivr;
724 724
                             $this->H[$i][$n]   = $this->cdivi;
725 725
                         } else {
726 726
                             // Solve complex equations
727
-                            $x = $this->H[$i][$i+1];
728
-                            $y = $this->H[$i+1][$i];
727
+                            $x = $this->H[$i][$i + 1];
728
+                            $y = $this->H[$i + 1][$i];
729 729
                             $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q;
730 730
                             $vi = ($this->d[$i] - $p) * 2.0 * $q;
731 731
                             if ($vr == 0.0 & $vi == 0.0) {
732 732
                                 $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z));
733 733
                             }
734 734
                             $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi);
735
-                            $this->H[$i][$n-1] = $this->cdivr;
735
+                            $this->H[$i][$n - 1] = $this->cdivr;
736 736
                             $this->H[$i][$n]   = $this->cdivi;
737 737
                             if (abs($x) > (abs($z) + abs($q))) {
738
-                                $this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x;
739
-                                $this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x;
738
+                                $this->H[$i + 1][$n - 1] = (-$ra - $w * $this->H[$i][$n - 1] + $q * $this->H[$i][$n]) / $x;
739
+                                $this->H[$i + 1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n - 1]) / $x;
740 740
                             } else {
741
-                                $this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q);
742
-                                $this->H[$i+1][$n-1] = $this->cdivr;
743
-                                $this->H[$i+1][$n]   = $this->cdivi;
741
+                                $this->cdiv(-$r - $y * $this->H[$i][$n - 1], -$s - $y * $this->H[$i][$n], $z, $q);
742
+                                $this->H[$i + 1][$n - 1] = $this->cdivr;
743
+                                $this->H[$i + 1][$n]   = $this->cdivi;
744 744
                             }
745 745
                         }
746 746
                         // Overflow control
747
-                        $t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
747
+                        $t = max(abs($this->H[$i][$n - 1]), abs($this->H[$i][$n]));
748 748
                         if (($eps * $t) * $t > 1) {
749 749
                             for ($j = $i; $j <= $n; ++$j) {
750
-                                $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
750
+                                $this->H[$j][$n - 1] = $this->H[$j][$n - 1] / $t;
751 751
                                 $this->H[$j][$n]   = $this->H[$j][$n] / $t;
752 752
                             }
753 753
                         }
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         }
767 767
 
768 768
         // Back transformation to get eigenvectors of original matrix
769
-        for ($j = $nn-1; $j >= $low; --$j) {
769
+        for ($j = $nn - 1; $j >= $low; --$j) {
770 770
             for ($i = $low; $i <= $high; ++$i) {
771 771
                 $z = 0.0;
772 772
                 for ($k = $low; $k <= min($j, $high); ++$k) {
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/Matrix.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                     } else {
197 197
                         throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
198 198
                     }
199
-                    $R = new Matrix($m+1, $n+1);
199
+                    $R = new Matrix($m + 1, $n + 1);
200 200
                     for ($i = $i0; $i <= $iF; ++$i) {
201 201
                         for ($j = $j0; $j <= $jF; ++$j) {
202 202
                             $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                     } else {
281 281
                         throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
282 282
                     }
283
-                    $R = new Matrix($m, $n+1);
283
+                    $R = new Matrix($m, $n + 1);
284 284
                     for ($i = 0; $i < $m; ++$i) {
285 285
                         for ($j = $j0; $j <= $jF; ++$j) {
286 286
                             $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
             $this->checkMatrixDimensions($M);
1100 1100
             for ($i = 0; $i < $this->m; ++$i) {
1101 1101
                 for ($j = 0; $j < $this->n; ++$j) {
1102
-                    $this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
1102
+                    $this->A[$i][$j] = trim($this->A[$i][$j], '"') . trim($M->get($i, $j), '"');
1103 1103
                 }
1104 1104
             }
1105 1105
             return $this;
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/QRDecomposition.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class QRDecomposition
23 23
 {
24
-    const MATRIX_RANK_EXCEPTION  = "Can only perform operation on full-rank matrix.";
24
+    const MATRIX_RANK_EXCEPTION = "Can only perform operation on full-rank matrix.";
25 25
 
26 26
     /**
27 27
      *    Array for internal storage of decomposition.
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
                     }
79 79
                     $this->QR[$k][$k] += 1.0;
80 80
                     // Apply transformation to remaining columns.
81
-                    for ($j = $k+1; $j < $this->n; ++$j) {
81
+                    for ($j = $k + 1; $j < $this->n; ++$j) {
82 82
                         $s = 0.0;
83 83
                         for ($i = $k; $i < $this->m; ++$i) {
84 84
                             $s += $this->QR[$i][$k] * $this->QR[$i][$j];
85 85
                         }
86
-                        $s = -$s/$this->QR[$k][$k];
86
+                        $s = -$s / $this->QR[$k][$k];
87 87
                         for ($i = $k; $i < $this->m; ++$i) {
88 88
                             $this->QR[$i][$j] += $s * $this->QR[$i][$k];
89 89
                         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function getQ()
161 161
     {
162
-        for ($k = $this->n-1; $k >= 0; --$k) {
162
+        for ($k = $this->n - 1; $k >= 0; --$k) {
163 163
             for ($i = 0; $i < $this->m; ++$i) {
164 164
                 $Q[$i][$k] = 0.0;
165 165
             }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                     for ($i = $k; $i < $this->m; ++$i) {
171 171
                         $s += $this->QR[$i][$k] * $Q[$i][$j];
172 172
                     }
173
-                    $s = -$s/$this->QR[$k][$k];
173
+                    $s = -$s / $this->QR[$k][$k];
174 174
                     for ($i = $k; $i < $this->m; ++$i) {
175 175
                         $Q[$i][$j] += $s * $this->QR[$i][$k];
176 176
                     }
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
                         for ($i = $k; $i < $this->m; ++$i) {
210 210
                             $s += $this->QR[$i][$k] * $X[$i][$j];
211 211
                         }
212
-                        $s = -$s/$this->QR[$k][$k];
212
+                        $s = -$s / $this->QR[$k][$k];
213 213
                         for ($i = $k; $i < $this->m; ++$i) {
214 214
                             $X[$i][$j] += $s * $this->QR[$i][$k];
215 215
                         }
216 216
                     }
217 217
                 }
218 218
                 // Solve R*X = Y;
219
-                for ($k = $this->n-1; $k >= 0; --$k) {
219
+                for ($k = $this->n - 1; $k >= 0; --$k) {
220 220
                     for ($j = 0; $j < $nx; ++$j) {
221 221
                         $X[$k][$j] /= $this->Rdiag[$k];
222 222
                     }
223 223
                     for ($i = 0; $i < $k; ++$i) {
224 224
                         for ($j = 0; $j < $nx; ++$j) {
225
-                            $X[$i][$j] -= $X[$k][$j]* $this->QR[$i][$k];
225
+                            $X[$i][$j] -= $X[$k][$j] * $this->QR[$i][$k];
226 226
                         }
227 227
                     }
228 228
                 }
229 229
                 $X = new Matrix($X);
230
-                return ($X->getMatrix(0, $this->n-1, 0, $nx));
230
+                return ($X->getMatrix(0, $this->n - 1, 0, $nx));
231 231
             } else {
232 232
                 throw new \PHPExcel\Calculation\Exception(self::MATRIX_RANK_EXCEPTION);
233 233
             }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
                     }
72 72
                 }
73 73
 
74
-                for ($k = $i+1; $k < $this->m; ++$k) {
74
+                for ($k = $i + 1; $k < $this->m; ++$k) {
75 75
                     $this->L[$i][$k] = 0.0;
76 76
                 }
77 77
             }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/LUDecomposition.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                 }
95 95
                 // Find pivot and exchange if necessary.
96 96
                 $p = $j;
97
-                for ($i = $j+1; $i < $this->m; ++$i) {
97
+                for ($i = $j + 1; $i < $this->m; ++$i) {
98 98
                     if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
99 99
                         $p = $i;
100 100
                     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                 }
113 113
                 // Compute multipliers.
114 114
                 if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
115
-                    for ($i = $j+1; $i < $this->m; ++$i) {
115
+                    for ($i = $j + 1; $i < $this->m; ++$i) {
116 116
                         $this->LU[$i][$j] /= $this->LU[$j][$j];
117 117
                     }
118 118
                 }
@@ -229,17 +229,17 @@  discard block
 block discarded – undo
229 229
             if ($this->isNonsingular()) {
230 230
                 // Copy right hand side with pivoting
231 231
                 $nx = $B->getColumnDimension();
232
-                $X  = $B->getMatrix($this->piv, 0, $nx-1);
232
+                $X  = $B->getMatrix($this->piv, 0, $nx - 1);
233 233
                 // Solve L*Y = B(piv,:)
234 234
                 for ($k = 0; $k < $this->n; ++$k) {
235
-                    for ($i = $k+1; $i < $this->n; ++$i) {
235
+                    for ($i = $k + 1; $i < $this->n; ++$i) {
236 236
                         for ($j = 0; $j < $nx; ++$j) {
237 237
                             $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
238 238
                         }
239 239
                     }
240 240
                 }
241 241
                 // Solve U*X = Y;
242
-                for ($k = $this->n-1; $k >= 0; --$k) {
242
+                for ($k = $this->n - 1; $k >= 0; --$k) {
243 243
                     for ($j = 0; $j < $nx; ++$j) {
244 244
                         $X->A[$k][$j] /= $this->LU[$k][$k];
245 245
                     }
Please login to merge, or discard this patch.
src/PhpSpreadsheet/Shared/JAMA/SingularValueDecomposition.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -131,27 +131,27 @@  discard block
 block discarded – undo
131 131
                     $e[$k] = hypo($e[$k], $e[$i]);
132 132
                 }
133 133
                 if ($e[$k] != 0.0) {
134
-                    if ($e[$k+1] < 0.0) {
134
+                    if ($e[$k + 1] < 0.0) {
135 135
                         $e[$k] = -$e[$k];
136 136
                     }
137 137
                     for ($i = $k + 1; $i < $this->n; ++$i) {
138 138
                         $e[$i] /= $e[$k];
139 139
                     }
140
-                    $e[$k+1] += 1.0;
140
+                    $e[$k + 1] += 1.0;
141 141
                 }
142 142
                 $e[$k] = -$e[$k];
143
-                if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
143
+                if (($k + 1 < $this->m) and ($e[$k] != 0.0)) {
144 144
                     // Apply the transformation.
145
-                    for ($i = $k+1; $i < $this->m; ++$i) {
145
+                    for ($i = $k + 1; $i < $this->m; ++$i) {
146 146
                         $work[$i] = 0.0;
147 147
                     }
148
-                    for ($j = $k+1; $j < $this->n; ++$j) {
149
-                        for ($i = $k+1; $i < $this->m; ++$i) {
148
+                    for ($j = $k + 1; $j < $this->n; ++$j) {
149
+                        for ($i = $k + 1; $i < $this->m; ++$i) {
150 150
                             $work[$i] += $e[$j] * $A[$i][$j];
151 151
                         }
152 152
                     }
153 153
                     for ($j = $k + 1; $j < $this->n; ++$j) {
154
-                        $t = -$e[$j] / $e[$k+1];
154
+                        $t = -$e[$j] / $e[$k + 1];
155 155
                         for ($i = $k + 1; $i < $this->m; ++$i) {
156 156
                             $A[$i][$j] += $t * $work[$i];
157 157
                         }
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
             $this->s[$nct] = $A[$nct][$nct];
174 174
         }
175 175
         if ($this->m < $p) {
176
-            $this->s[$p-1] = 0.0;
176
+            $this->s[$p - 1] = 0.0;
177 177
         }
178 178
         if ($nrt + 1 < $p) {
179
-            $e[$nrt] = $A[$nrt][$p-1];
179
+            $e[$nrt] = $A[$nrt][$p - 1];
180 180
         }
181
-        $e[$p-1] = 0.0;
181
+        $e[$p - 1] = 0.0;
182 182
         // If required, generate U.
183 183
         if ($wantu) {
184 184
             for ($j = $nct; $j < $nu; ++$j) {
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
                     for ($j = $k + 1; $j < $nu; ++$j) {
223 223
                         $t = 0;
224 224
                         for ($i = $k + 1; $i < $this->n; ++$i) {
225
-                            $t += $this->V[$i][$k]* $this->V[$i][$j];
225
+                            $t += $this->V[$i][$k] * $this->V[$i][$j];
226 226
                         }
227
-                        $t = -$t / $this->V[$k+1][$k];
227
+                        $t = -$t / $this->V[$k + 1][$k];
228 228
                         for ($i = $k + 1; $i < $this->n; ++$i) {
229 229
                             $this->V[$i][$j] += $t * $this->V[$i][$k];
230 230
                         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                 if ($k == -1) {
257 257
                     break;
258 258
                 }
259
-                if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) {
259
+                if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k + 1]))) {
260 260
                     $e[$k] = 0.0;
261 261
                     break;
262 262
                 }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     if ($ks == $k) {
269 269
                         break;
270 270
                     }
271
-                    $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
271
+                    $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks - 1]) : 0.);
272 272
                     if (abs($this->s[$ks]) <= $eps * $t) {
273 273
                         $this->s[$ks] = 0.0;
274 274
                         break;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
                 }
277 277
                 if ($ks == $k) {
278 278
                     $kase = 3;
279
-                } elseif ($ks == $p-1) {
279
+                } elseif ($ks == $p - 1) {
280 280
                     $kase = 1;
281 281
                 } else {
282 282
                     $kase = 2;
@@ -289,21 +289,21 @@  discard block
 block discarded – undo
289 289
             switch ($kase) {
290 290
                 // Deflate negligible s(p).
291 291
                 case 1:
292
-                    $f = $e[$p-2];
293
-                    $e[$p-2] = 0.0;
292
+                    $f = $e[$p - 2];
293
+                    $e[$p - 2] = 0.0;
294 294
                     for ($j = $p - 2; $j >= $k; --$j) {
295 295
                         $t  = hypo($this->s[$j], $f);
296 296
                         $cs = $this->s[$j] / $t;
297 297
                         $sn = $f / $t;
298 298
                         $this->s[$j] = $t;
299 299
                         if ($j != $k) {
300
-                            $f = -$sn * $e[$j-1];
301
-                            $e[$j-1] = $cs * $e[$j-1];
300
+                            $f = -$sn * $e[$j - 1];
301
+                            $e[$j - 1] = $cs * $e[$j - 1];
302 302
                         }
303 303
                         if ($wantv) {
304 304
                             for ($i = 0; $i < $this->n; ++$i) {
305
-                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
306
-                                $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
305
+                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p - 1];
306
+                                $this->V[$i][$p - 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p - 1];
307 307
                                 $this->V[$i][$j] = $t;
308 308
                             }
309 309
                         }
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
                     break;
312 312
                 // Split at negligible s(k).
313 313
                 case 2:
314
-                    $f = $e[$k-1];
315
-                    $e[$k-1] = 0.0;
314
+                    $f = $e[$k - 1];
315
+                    $e[$k - 1] = 0.0;
316 316
                     for ($j = $k; $j < $p; ++$j) {
317 317
                         $t = hypo($this->s[$j], $f);
318 318
                         $cs = $this->s[$j] / $t;
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
                         $e[$j] = $cs * $e[$j];
323 323
                         if ($wantu) {
324 324
                             for ($i = 0; $i < $this->m; ++$i) {
325
-                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
326
-                                $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
325
+                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k - 1];
326
+                                $this->U[$i][$k - 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k - 1];
327 327
                                 $this->U[$i][$j] = $t;
328 328
                             }
329 329
                         }
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
                 // Perform one qr step.
333 333
                 case 3:
334 334
                     // Calculate the shift.
335
-                    $scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
336
-                    $sp   = $this->s[$p-1] / $scale;
337
-                    $spm1 = $this->s[$p-2] / $scale;
338
-                    $epm1 = $e[$p-2] / $scale;
335
+                    $scale = max(max(max(max(abs($this->s[$p - 1]), abs($this->s[$p - 2])), abs($e[$p - 2])), abs($this->s[$k])), abs($e[$k]));
336
+                    $sp   = $this->s[$p - 1] / $scale;
337
+                    $spm1 = $this->s[$p - 2] / $scale;
338
+                    $epm1 = $e[$p - 2] / $scale;
339 339
                     $sk   = $this->s[$k] / $scale;
340 340
                     $ek   = $e[$k] / $scale;
341 341
                     $b    = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
@@ -351,41 +351,41 @@  discard block
 block discarded – undo
351 351
                     $f = ($sk + $sp) * ($sk - $sp) + $shift;
352 352
                     $g = $sk * $ek;
353 353
                     // Chase zeros.
354
-                    for ($j = $k; $j < $p-1; ++$j) {
354
+                    for ($j = $k; $j < $p - 1; ++$j) {
355 355
                         $t  = hypo($f, $g);
356
-                        $cs = $f/$t;
357
-                        $sn = $g/$t;
356
+                        $cs = $f / $t;
357
+                        $sn = $g / $t;
358 358
                         if ($j != $k) {
359
-                            $e[$j-1] = $t;
359
+                            $e[$j - 1] = $t;
360 360
                         }
361 361
                         $f = $cs * $this->s[$j] + $sn * $e[$j];
362 362
                         $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
363
-                        $g = $sn * $this->s[$j+1];
364
-                        $this->s[$j+1] = $cs * $this->s[$j+1];
363
+                        $g = $sn * $this->s[$j + 1];
364
+                        $this->s[$j + 1] = $cs * $this->s[$j + 1];
365 365
                         if ($wantv) {
366 366
                             for ($i = 0; $i < $this->n; ++$i) {
367
-                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
368
-                                $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
367
+                                $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j + 1];
368
+                                $this->V[$i][$j + 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j + 1];
369 369
                                 $this->V[$i][$j] = $t;
370 370
                             }
371 371
                         }
372 372
                         $t = hypo($f, $g);
373
-                        $cs = $f/$t;
374
-                        $sn = $g/$t;
373
+                        $cs = $f / $t;
374
+                        $sn = $g / $t;
375 375
                         $this->s[$j] = $t;
376
-                        $f = $cs * $e[$j] + $sn * $this->s[$j+1];
377
-                        $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
378
-                        $g = $sn * $e[$j+1];
379
-                        $e[$j+1] = $cs * $e[$j+1];
376
+                        $f = $cs * $e[$j] + $sn * $this->s[$j + 1];
377
+                        $this->s[$j + 1] = -$sn * $e[$j] + $cs * $this->s[$j + 1];
378
+                        $g = $sn * $e[$j + 1];
379
+                        $e[$j + 1] = $cs * $e[$j + 1];
380 380
                         if ($wantu && ($j < $this->m - 1)) {
381 381
                             for ($i = 0; $i < $this->m; ++$i) {
382
-                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
383
-                                $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
382
+                                $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j + 1];
383
+                                $this->U[$i][$j + 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j + 1];
384 384
                                 $this->U[$i][$j] = $t;
385 385
                             }
386 386
                         }
387 387
                     }
388
-                    $e[$p-2] = $f;
388
+                    $e[$p - 2] = $f;
389 389
                     $iter = $iter + 1;
390 390
                     break;
391 391
                 // Convergence.
@@ -401,23 +401,23 @@  discard block
 block discarded – undo
401 401
                     }
402 402
                     // Order the singular values.
403 403
                     while ($k < $pp) {
404
-                        if ($this->s[$k] >= $this->s[$k+1]) {
404
+                        if ($this->s[$k] >= $this->s[$k + 1]) {
405 405
                             break;
406 406
                         }
407 407
                         $t = $this->s[$k];
408
-                        $this->s[$k] = $this->s[$k+1];
409
-                        $this->s[$k+1] = $t;
408
+                        $this->s[$k] = $this->s[$k + 1];
409
+                        $this->s[$k + 1] = $t;
410 410
                         if ($wantv and ($k < $this->n - 1)) {
411 411
                             for ($i = 0; $i < $this->n; ++$i) {
412
-                                $t = $this->V[$i][$k+1];
413
-                                $this->V[$i][$k+1] = $this->V[$i][$k];
412
+                                $t = $this->V[$i][$k + 1];
413
+                                $this->V[$i][$k + 1] = $this->V[$i][$k];
414 414
                                 $this->V[$i][$k] = $t;
415 415
                             }
416 416
                         }
417
-                        if ($wantu and ($k < $this->m-1)) {
417
+                        if ($wantu and ($k < $this->m - 1)) {
418 418
                             for ($i = 0; $i < $this->m; ++$i) {
419
-                                $t = $this->U[$i][$k+1];
420
-                                $this->U[$i][$k+1] = $this->U[$i][$k];
419
+                                $t = $this->U[$i][$k + 1];
420
+                                $this->U[$i][$k + 1] = $this->U[$i][$k];
421 421
                                 $this->U[$i][$k] = $t;
422 422
                             }
423 423
                         }
Please login to merge, or discard this patch.