Completed
Pull Request — master (#90)
by Reginaldo
18:50
created
app/Vendor/PHPExcel/PHPExcel/Shared/File.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@
 block discarded – undo
36 36
 class PHPExcel_Shared_File
37 37
 {
38 38
 	/**
39
-	  * Verify if a file exists
40
-	  *
41
-	  * @param 	string	$pFilename	Filename
42
-	  * @return bool
43
-	  */
39
+	 * Verify if a file exists
40
+	 *
41
+	 * @param 	string	$pFilename	Filename
42
+	 * @return bool
43
+	 */
44 44
 	public static function file_exists($pFilename) {
45 45
 		// Sick construction, but it seems that
46 46
 		// file_exists returns strange values when
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 		// Sick construction, but it seems that
46 46
 		// file_exists returns strange values when
47 47
 		// doing the original file_exists on ZIP archives...
48
-		if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
48
+		if (strtolower(substr($pFilename, 0, 3)) == 'zip') {
49 49
 			// Open ZIP file and verify if the file exists
50
-			$zipFile 		= substr($pFilename, 6, strpos($pFilename, '#') - 6);
51
-			$archiveFile 	= substr($pFilename, strpos($pFilename, '#') + 1);
50
+			$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
51
+			$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
52 52
 
53 53
 			$zip = new ZipArchive();
54 54
 			if ($zip->open($zipFile) === true) {
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 
82 82
 		// Found something?
83 83
 		if ($returnValue == '' || ($returnValue === NULL)) {
84
-			$pathArray = explode('/' , $pFilename);
85
-			while(in_array('..', $pathArray) && $pathArray[0] != '..') {
84
+			$pathArray = explode('/', $pFilename);
85
+			while (in_array('..', $pathArray) && $pathArray[0] != '..') {
86 86
 				for ($i = 0; $i < count($pathArray); ++$i) {
87 87
 					if ($pathArray[$i] == '..' && $i > 0) {
88 88
 						unset($pathArray[$i]);
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 		// sys_get_temp_dir is only available since PHP 5.2.1
109 109
 		// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
110 110
 
111
-		if ( !function_exists('sys_get_temp_dir')) {
112
-			if ($temp = getenv('TMP') ) {
111
+		if ( ! function_exists('sys_get_temp_dir')) {
112
+			if ($temp = getenv('TMP')) {
113 113
 				if (file_exists($temp)) { return realpath($temp); }
114 114
 			}
115
-			if ($temp = getenv('TEMP') ) {
115
+			if ($temp = getenv('TEMP')) {
116 116
 				if (file_exists($temp)) { return realpath($temp); }
117 117
 			}
118
-			if ($temp = getenv('TMPDIR') ) {
118
+			if ($temp = getenv('TMPDIR')) {
119 119
 				if (file_exists($temp)) { return realpath($temp); }
120 120
 			}
121 121
 
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/CholeskyDecomposition.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			$this->L = $A->getArray();
51 51
 			$this->m = $A->getRowDimension();
52 52
 
53
-			for($i = 0; $i < $this->m; ++$i) {
54
-				for($j = $i; $j < $this->m; ++$j) {
55
-					for($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
53
+			for ($i = 0; $i < $this->m; ++$i) {
54
+				for ($j = $i; $j < $this->m; ++$j) {
55
+					for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
56 56
 						$sum -= $this->L[$i][$k] * $this->L[$j][$k];
57 57
 					}
58 58
 					if ($i == $j) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 					}
69 69
 				}
70 70
 
71
-				for ($k = $i+1; $k < $this->m; ++$k) {
71
+				for ($k = $i + 1; $k < $this->m; ++$k) {
72 72
 					$this->L[$i][$k] = 0.0;
73 73
 				}
74 74
 			}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,21 +49,21 @@
 block discarded – undo
49 49
 	private $V = array();
50 50
 
51 51
 	/**
52
-	*	Array for internal storage of nonsymmetric Hessenberg form.
53
-	*	@var array
54
-	*/
52
+	 *	Array for internal storage of nonsymmetric Hessenberg form.
53
+	 *	@var array
54
+	 */
55 55
 	private $H = array();
56 56
 
57 57
 	/**
58
-	*	Working storage for nonsymmetric algorithm.
59
-	*	@var array
60
-	*/
58
+	 *	Working storage for nonsymmetric algorithm.
59
+	 *	@var array
60
+	 */
61 61
 	private $ort;
62 62
 
63 63
 	/**
64
-	*	Used for complex scalar division.
65
-	*	@var float
66
-	*/
64
+	 *	Used for complex scalar division.
65
+	 *	@var float
66
+	 */
67 67
 	private $cdivr;
68 68
 	private $cdivi;
69 69
 
Please login to merge, or discard this patch.
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 *	@access private
75 75
 	 */
76
-	private function tred2 () {
76
+	private function tred2() {
77 77
 		//  This is derived from the Algol procedures tred2 by
78 78
 		//  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
79 79
 		//  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
80 80
 		//  Fortran subroutine in EISPACK.
81
-		$this->d = $this->V[$this->n-1];
81
+		$this->d = $this->V[$this->n - 1];
82 82
 		// Householder reduction to tridiagonal form.
83
-		for ($i = $this->n-1; $i > 0; --$i) {
84
-			$i_ = $i -1;
83
+		for ($i = $this->n - 1; $i > 0; --$i) {
84
+			$i_ = $i - 1;
85 85
 			// Scale to avoid under/overflow.
86 86
 			$h = $scale = 0.0;
87 87
 			$scale += array_sum(array_map(abs, $this->d));
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 					$f = $this->d[$j];
114 114
 					$this->V[$j][$i] = $f;
115 115
 					$g = $this->e[$j] + $this->V[$j][$j] * $f;
116
-					for ($k = $j+1; $k <= $i_; ++$k) {
116
+					for ($k = $j + 1; $k <= $i_; ++$k) {
117 117
 						$g += $this->V[$k][$j] * $this->d[$k];
118 118
 						$this->e[$k] += $this->V[$k][$j] * $f;
119 119
 					}
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 					$f += $this->e[$j] * $this->d[$j];
126 126
 				}
127 127
 				$hh = $f / (2 * $h);
128
-				for ($j=0; $j < $i; ++$j) {
128
+				for ($j = 0; $j < $i; ++$j) {
129 129
 					$this->e[$j] -= $hh * $this->d[$j];
130 130
 				}
131 131
 				for ($j = 0; $j < $i; ++$j) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 					for ($k = $j; $k <= $i_; ++$k) {
135 135
 						$this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]);
136 136
 					}
137
-					$this->d[$j] = $this->V[$i-1][$j];
137
+					$this->d[$j] = $this->V[$i - 1][$j];
138 138
 					$this->V[$i][$j] = 0.0;
139 139
 				}
140 140
 			}
@@ -142,18 +142,18 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		// Accumulate transformations.
145
-		for ($i = 0; $i < $this->n-1; ++$i) {
146
-			$this->V[$this->n-1][$i] = $this->V[$i][$i];
145
+		for ($i = 0; $i < $this->n - 1; ++$i) {
146
+			$this->V[$this->n - 1][$i] = $this->V[$i][$i];
147 147
 			$this->V[$i][$i] = 1.0;
148
-			$h = $this->d[$i+1];
148
+			$h = $this->d[$i + 1];
149 149
 			if ($h != 0.0) {
150 150
 				for ($k = 0; $k <= $i; ++$k) {
151
-					$this->d[$k] = $this->V[$k][$i+1] / $h;
151
+					$this->d[$k] = $this->V[$k][$i + 1] / $h;
152 152
 				}
153 153
 				for ($j = 0; $j <= $i; ++$j) {
154 154
 					$g = 0.0;
155 155
 					for ($k = 0; $k <= $i; ++$k) {
156
-						$g += $this->V[$k][$i+1] * $this->V[$k][$j];
156
+						$g += $this->V[$k][$i + 1] * $this->V[$k][$j];
157 157
 					}
158 158
 					for ($k = 0; $k <= $i; ++$k) {
159 159
 						$this->V[$k][$j] -= $g * $this->d[$k];
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 			for ($k = 0; $k <= $i; ++$k) {
164
-				$this->V[$k][$i+1] = 0.0;
164
+				$this->V[$k][$i + 1] = 0.0;
165 165
 			}
166 166
 		}
167 167
 
168
-		$this->d = $this->V[$this->n-1];
169
-		$this->V[$this->n-1] = array_fill(0, $j, 0.0);
170
-		$this->V[$this->n-1][$this->n-1] = 1.0;
168
+		$this->d = $this->V[$this->n - 1];
169
+		$this->V[$this->n - 1] = array_fill(0, $j, 0.0);
170
+		$this->V[$this->n - 1][$this->n - 1] = 1.0;
171 171
 		$this->e[0] = 0.0;
172 172
 	}
173 173
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	private function tql2() {
186 186
 		for ($i = 1; $i < $this->n; ++$i) {
187
-			$this->e[$i-1] = $this->e[$i];
187
+			$this->e[$i - 1] = $this->e[$i];
188 188
 		}
189
-		$this->e[$this->n-1] = 0.0;
189
+		$this->e[$this->n - 1] = 0.0;
190 190
 		$f = 0.0;
191 191
 		$tst1 = 0.0;
192
-		$eps  = pow(2.0,-52.0);
192
+		$eps  = pow(2.0, -52.0);
193 193
 
194 194
 		for ($l = 0; $l < $this->n; ++$l) {
195 195
 			// Find small subdiagonal element
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 					$iter += 1;
210 210
 					// Compute implicit shift
211 211
 					$g = $this->d[$l];
212
-					$p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
212
+					$p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]);
213 213
 					$r = hypo($p, 1.0);
214 214
 					if ($p < 0)
215 215
 						$r *= -1;
216 216
 					$this->d[$l] = $this->e[$l] / ($p + $r);
217
-					$this->d[$l+1] = $this->e[$l] * ($p + $r);
218
-					$dl1 = $this->d[$l+1];
217
+					$this->d[$l + 1] = $this->e[$l] * ($p + $r);
218
+					$dl1 = $this->d[$l + 1];
219 219
 					$h = $g - $this->d[$l];
220 220
 					for ($i = $l + 2; $i < $this->n; ++$i)
221 221
 						$this->d[$i] -= $h;
@@ -226,22 +226,22 @@  discard block
 block discarded – undo
226 226
 					$c2 = $c3 = $c;
227 227
 					$el1 = $this->e[$l + 1];
228 228
 					$s = $s2 = 0.0;
229
-					for ($i = $m-1; $i >= $l; --$i) {
229
+					for ($i = $m - 1; $i >= $l; --$i) {
230 230
 						$c3 = $c2;
231 231
 						$c2 = $c;
232 232
 						$s2 = $s;
233 233
 						$g  = $c * $this->e[$i];
234 234
 						$h  = $c * $p;
235 235
 						$r  = hypo($p, $this->e[$i]);
236
-						$this->e[$i+1] = $s * $r;
236
+						$this->e[$i + 1] = $s * $r;
237 237
 						$s = $this->e[$i] / $r;
238 238
 						$c = $p / $r;
239 239
 						$p = $c * $this->d[$i] - $s * $g;
240
-						$this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]);
240
+						$this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]);
241 241
 						// Accumulate transformation.
242 242
 						for ($k = 0; $k < $this->n; ++$k) {
243
-							$h = $this->V[$k][$i+1];
244
-							$this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h;
243
+							$h = $this->V[$k][$i + 1];
244
+							$this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h;
245 245
 							$this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
246 246
 						}
247 247
 					}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		for ($i = 0; $i < $this->n - 1; ++$i) {
260 260
 			$k = $i;
261 261
 			$p = $this->d[$i];
262
-			for ($j = $i+1; $j < $this->n; ++$j) {
262
+			for ($j = $i + 1; $j < $this->n; ++$j) {
263 263
 				if ($this->d[$j] < $p) {
264 264
 					$k = $j;
265 265
 					$p = $this->d[$j];
@@ -288,21 +288,21 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 *	@access private
290 290
 	 */
291
-	private function orthes () {
291
+	private function orthes() {
292 292
 		$low  = 0;
293
-		$high = $this->n-1;
293
+		$high = $this->n - 1;
294 294
 
295
-		for ($m = $low+1; $m <= $high-1; ++$m) {
295
+		for ($m = $low + 1; $m <= $high - 1; ++$m) {
296 296
 			// Scale column.
297 297
 			$scale = 0.0;
298 298
 			for ($i = $m; $i <= $high; ++$i) {
299
-				$scale = $scale + abs($this->H[$i][$m-1]);
299
+				$scale = $scale + abs($this->H[$i][$m - 1]);
300 300
 			}
301 301
 			if ($scale != 0.0) {
302 302
 				// Compute Householder transformation.
303 303
 				$h = 0.0;
304 304
 				for ($i = $high; $i >= $m; --$i) {
305
-					$this->ort[$i] = $this->H[$i][$m-1] / $scale;
305
+					$this->ort[$i] = $this->H[$i][$m - 1] / $scale;
306 306
 					$h += $this->ort[$i] * $this->ort[$i];
307 307
 				}
308 308
 				$g = sqrt($h);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 					}
335 335
 				}
336 336
 				$this->ort[$m] = $scale * $this->ort[$m];
337
-				$this->H[$m][$m-1] = $scale * $g;
337
+				$this->H[$m][$m - 1] = $scale * $g;
338 338
 			}
339 339
 		}
340 340
 
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 				$this->V[$i][$j] = ($i == $j ? 1.0 : 0.0);
345 345
 			}
346 346
 		}
347
-		for ($m = $high-1; $m >= $low+1; --$m) {
348
-			if ($this->H[$m][$m-1] != 0.0) {
349
-				for ($i = $m+1; $i <= $high; ++$i) {
350
-					$this->ort[$i] = $this->H[$i][$m-1];
347
+		for ($m = $high - 1; $m >= $low + 1; --$m) {
348
+			if ($this->H[$m][$m - 1] != 0.0) {
349
+				for ($i = $m + 1; $i <= $high; ++$i) {
350
+					$this->ort[$i] = $this->H[$i][$m - 1];
351 351
 				}
352 352
 				for ($j = $m; $j <= $high; ++$j) {
353 353
 					$g = 0.0;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 						$g += $this->ort[$i] * $this->V[$i][$j];
356 356
 					}
357 357
 					// Double division avoids possible underflow
358
-					$g = ($g / $this->ort[$m]) / $this->H[$m][$m-1];
358
+					$g = ($g / $this->ort[$m]) / $this->H[$m][$m - 1];
359 359
 					for ($i = $m; $i <= $high; ++$i) {
360 360
 						$this->V[$i][$j] += $g * $this->ort[$i];
361 361
 					}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 *	@access private
397 397
 	 */
398
-	private function hqr2 () {
398
+	private function hqr2() {
399 399
 		//  Initialize
400 400
 		$nn = $this->n;
401 401
 		$n  = $nn - 1;
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 				$this->d[$i] = $this->H[$i][$i];
413 413
 				$this->e[$i] = 0.0;
414 414
 			}
415
-			for ($j = max($i-1, 0); $j < $nn; ++$j) {
415
+			for ($j = max($i - 1, 0); $j < $nn; ++$j) {
416 416
 				$norm = $norm + abs($this->H[$i][$j]);
417 417
 			}
418 418
 		}
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
 			// Look for single small sub-diagonal element
424 424
 			$l = $n;
425 425
 			while ($l > $low) {
426
-				$s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]);
426
+				$s = abs($this->H[$l - 1][$l - 1]) + abs($this->H[$l][$l]);
427 427
 				if ($s == 0.0) {
428 428
 					$s = $norm;
429 429
 				}
430
-				if (abs($this->H[$l][$l-1]) < $eps * $s) {
430
+				if (abs($this->H[$l][$l - 1]) < $eps * $s) {
431 431
 					break;
432 432
 				}
433 433
 				--$l;
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 				--$n;
442 442
 				$iter = 0;
443 443
 			// Two roots found
444
-			} else if ($l == $n-1) {
445
-				$w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
446
-				$p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
444
+			} else if ($l == $n - 1) {
445
+				$w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
446
+				$p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0;
447 447
 				$q = $p * $p + $w;
448 448
 				$z = sqrt(abs($q));
449 449
 				$this->H[$n][$n] = $this->H[$n][$n] + $exshift;
450
-				$this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift;
450
+				$this->H[$n - 1][$n - 1] = $this->H[$n - 1][$n - 1] + $exshift;
451 451
 				$x = $this->H[$n][$n];
452 452
 				// Real pair
453 453
 				if ($q >= 0) {
@@ -456,14 +456,14 @@  discard block
 block discarded – undo
456 456
 					} else {
457 457
 						$z = $p - $z;
458 458
 					}
459
-					$this->d[$n-1] = $x + $z;
460
-					$this->d[$n] = $this->d[$n-1];
459
+					$this->d[$n - 1] = $x + $z;
460
+					$this->d[$n] = $this->d[$n - 1];
461 461
 					if ($z != 0.0) {
462 462
 						$this->d[$n] = $x - $w / $z;
463 463
 					}
464
-					$this->e[$n-1] = 0.0;
464
+					$this->e[$n - 1] = 0.0;
465 465
 					$this->e[$n] = 0.0;
466
-					$x = $this->H[$n][$n-1];
466
+					$x = $this->H[$n][$n - 1];
467 467
 					$s = abs($x) + abs($z);
468 468
 					$p = $x / $s;
469 469
 					$q = $z / $s;
@@ -471,28 +471,28 @@  discard block
 block discarded – undo
471 471
 					$p = $p / $r;
472 472
 					$q = $q / $r;
473 473
 					// Row modification
474
-					for ($j = $n-1; $j < $nn; ++$j) {
475
-						$z = $this->H[$n-1][$j];
476
-						$this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j];
474
+					for ($j = $n - 1; $j < $nn; ++$j) {
475
+						$z = $this->H[$n - 1][$j];
476
+						$this->H[$n - 1][$j] = $q * $z + $p * $this->H[$n][$j];
477 477
 						$this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
478 478
 					}
479 479
 					// Column modification
480 480
 					for ($i = 0; $i <= n; ++$i) {
481
-						$z = $this->H[$i][$n-1];
482
-						$this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
481
+						$z = $this->H[$i][$n - 1];
482
+						$this->H[$i][$n - 1] = $q * $z + $p * $this->H[$i][$n];
483 483
 						$this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
484 484
 					}
485 485
 					// Accumulate transformations
486 486
 					for ($i = $low; $i <= $high; ++$i) {
487
-						$z = $this->V[$i][$n-1];
488
-						$this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n];
487
+						$z = $this->V[$i][$n - 1];
488
+						$this->V[$i][$n - 1] = $q * $z + $p * $this->V[$i][$n];
489 489
 						$this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z;
490 490
 					}
491 491
 				// Complex pair
492 492
 				} else {
493
-					$this->d[$n-1] = $x + $p;
493
+					$this->d[$n - 1] = $x + $p;
494 494
 					$this->d[$n] = $x + $p;
495
-					$this->e[$n-1] = $z;
495
+					$this->e[$n - 1] = $z;
496 496
 					$this->e[$n] = -$z;
497 497
 				}
498 498
 				$n = $n - 2;
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 				$y = 0.0;
505 505
 				$w = 0.0;
506 506
 				if ($l < $n) {
507
-					$y = $this->H[$n-1][$n-1];
508
-					$w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
507
+					$y = $this->H[$n - 1][$n - 1];
508
+					$w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n];
509 509
 				}
510 510
 				// Wilkinson's original ad hoc shift
511 511
 				if ($iter == 10) {
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 					for ($i = $low; $i <= $n; ++$i) {
514 514
 						$this->H[$i][$i] -= $x;
515 515
 					}
516
-					$s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]);
516
+					$s = abs($this->H[$n][$n - 1]) + abs($this->H[$n - 1][$n - 2]);
517 517
 					$x = $y = 0.75 * $s;
518 518
 					$w = -0.4375 * $s * $s;
519 519
 				}
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 					$z = $this->H[$m][$m];
543 543
 					$r = $x - $z;
544 544
 					$s = $y - $z;
545
-					$p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1];
546
-					$q = $this->H[$m+1][$m+1] - $z - $r - $s;
547
-					$r = $this->H[$m+2][$m+1];
545
+					$p = ($r * $s - $w) / $this->H[$m + 1][$m] + $this->H[$m][$m + 1];
546
+					$q = $this->H[$m + 1][$m + 1] - $z - $r - $s;
547
+					$r = $this->H[$m + 2][$m + 1];
548 548
 					$s = abs($p) + abs($q) + abs($r);
549 549
 					$p = $p / $s;
550 550
 					$q = $q / $s;
@@ -552,25 +552,25 @@  discard block
 block discarded – undo
552 552
 					if ($m == $l) {
553 553
 						break;
554 554
 					}
555
-					if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) <
556
-						$eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) {
555
+					if (abs($this->H[$m][$m - 1]) * (abs($q) + abs($r)) <
556
+						$eps * (abs($p) * (abs($this->H[$m - 1][$m - 1]) + abs($z) + abs($this->H[$m + 1][$m + 1])))) {
557 557
 						break;
558 558
 					}
559 559
 					--$m;
560 560
 				}
561 561
 				for ($i = $m + 2; $i <= $n; ++$i) {
562
-					$this->H[$i][$i-2] = 0.0;
563
-					if ($i > $m+2) {
564
-						$this->H[$i][$i-3] = 0.0;
562
+					$this->H[$i][$i - 2] = 0.0;
563
+					if ($i > $m + 2) {
564
+						$this->H[$i][$i - 3] = 0.0;
565 565
 					}
566 566
 				}
567 567
 				// Double QR step involving rows l:n and columns m:n
568
-				for ($k = $m; $k <= $n-1; ++$k) {
569
-					$notlast = ($k != $n-1);
568
+				for ($k = $m; $k <= $n - 1; ++$k) {
569
+					$notlast = ($k != $n - 1);
570 570
 					if ($k != $m) {
571
-						$p = $this->H[$k][$k-1];
572
-						$q = $this->H[$k+1][$k-1];
573
-						$r = ($notlast ? $this->H[$k+2][$k-1] : 0.0);
571
+						$p = $this->H[$k][$k - 1];
572
+						$q = $this->H[$k + 1][$k - 1];
573
+						$r = ($notlast ? $this->H[$k + 2][$k - 1] : 0.0);
574 574
 						$x = abs($p) + abs($q) + abs($r);
575 575
 						if ($x != 0.0) {
576 576
 							$p = $p / $x;
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
 					}
588 588
 					if ($s != 0) {
589 589
 						if ($k != $m) {
590
-							$this->H[$k][$k-1] = -$s * $x;
590
+							$this->H[$k][$k - 1] = -$s * $x;
591 591
 						} elseif ($l != $m) {
592
-							$this->H[$k][$k-1] = -$this->H[$k][$k-1];
592
+							$this->H[$k][$k - 1] = -$this->H[$k][$k - 1];
593 593
 						}
594 594
 						$p = $p + $s;
595 595
 						$x = $p / $s;
@@ -599,33 +599,33 @@  discard block
 block discarded – undo
599 599
 						$r = $r / $p;
600 600
 						// Row modification
601 601
 						for ($j = $k; $j < $nn; ++$j) {
602
-							$p = $this->H[$k][$j] + $q * $this->H[$k+1][$j];
602
+							$p = $this->H[$k][$j] + $q * $this->H[$k + 1][$j];
603 603
 							if ($notlast) {
604
-								$p = $p + $r * $this->H[$k+2][$j];
605
-								$this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z;
604
+								$p = $p + $r * $this->H[$k + 2][$j];
605
+								$this->H[$k + 2][$j] = $this->H[$k + 2][$j] - $p * $z;
606 606
 							}
607 607
 							$this->H[$k][$j] = $this->H[$k][$j] - $p * $x;
608
-							$this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y;
608
+							$this->H[$k + 1][$j] = $this->H[$k + 1][$j] - $p * $y;
609 609
 						}
610 610
 						// Column modification
611
-						for ($i = 0; $i <= min($n, $k+3); ++$i) {
612
-							$p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1];
611
+						for ($i = 0; $i <= min($n, $k + 3); ++$i) {
612
+							$p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k + 1];
613 613
 							if ($notlast) {
614
-								$p = $p + $z * $this->H[$i][$k+2];
615
-								$this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r;
614
+								$p = $p + $z * $this->H[$i][$k + 2];
615
+								$this->H[$i][$k + 2] = $this->H[$i][$k + 2] - $p * $r;
616 616
 							}
617 617
 							$this->H[$i][$k] = $this->H[$i][$k] - $p;
618
-							$this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q;
618
+							$this->H[$i][$k + 1] = $this->H[$i][$k + 1] - $p * $q;
619 619
 						}
620 620
 						// Accumulate transformations
621 621
 						for ($i = $low; $i <= $high; ++$i) {
622
-							$p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1];
622
+							$p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k + 1];
623 623
 							if ($notlast) {
624
-								$p = $p + $z * $this->V[$i][$k+2];
625
-								$this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r;
624
+								$p = $p + $z * $this->V[$i][$k + 2];
625
+								$this->V[$i][$k + 2] = $this->V[$i][$k + 2] - $p * $r;
626 626
 							}
627 627
 							$this->V[$i][$k] = $this->V[$i][$k] - $p;
628
-							$this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q;
628
+							$this->V[$i][$k + 1] = $this->V[$i][$k + 1] - $p * $q;
629 629
 						}
630 630
 					}  // ($s != 0)
631 631
 				}  // k loop
@@ -637,14 +637,14 @@  discard block
 block discarded – undo
637 637
 			return;
638 638
 		}
639 639
 
640
-		for ($n = $nn-1; $n >= 0; --$n) {
640
+		for ($n = $nn - 1; $n >= 0; --$n) {
641 641
 			$p = $this->d[$n];
642 642
 			$q = $this->e[$n];
643 643
 			// Real vector
644 644
 			if ($q == 0) {
645 645
 				$l = $n;
646 646
 				$this->H[$n][$n] = 1.0;
647
-				for ($i = $n-1; $i >= 0; --$i) {
647
+				for ($i = $n - 1; $i >= 0; --$i) {
648 648
 					$w = $this->H[$i][$i] - $p;
649 649
 					$r = 0.0;
650 650
 					for ($j = $l; $j <= $n; ++$j) {
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
 							}
664 664
 						// Solve real equations
665 665
 						} else {
666
-							$x = $this->H[$i][$i+1];
667
-							$y = $this->H[$i+1][$i];
666
+							$x = $this->H[$i][$i + 1];
667
+							$y = $this->H[$i + 1][$i];
668 668
 							$q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i];
669 669
 							$t = ($x * $s - $z * $r) / $q;
670 670
 							$this->H[$i][$n] = $t;
671 671
 							if (abs($x) > abs($z)) {
672
-								$this->H[$i+1][$n] = (-$r - $w * $t) / $x;
672
+								$this->H[$i + 1][$n] = (-$r - $w * $t) / $x;
673 673
 							} else {
674
-								$this->H[$i+1][$n] = (-$s - $y * $t) / $z;
674
+								$this->H[$i + 1][$n] = (-$s - $y * $t) / $z;
675 675
 							}
676 676
 						}
677 677
 						// Overflow control
@@ -685,24 +685,24 @@  discard block
 block discarded – undo
685 685
 				}
686 686
 			// Complex vector
687 687
 			} else if ($q < 0) {
688
-				$l = $n-1;
688
+				$l = $n - 1;
689 689
 				// Last vector component imaginary so matrix is triangular
690
-				if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
691
-					$this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1];
692
-					$this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1];
690
+				if (abs($this->H[$n][$n - 1]) > abs($this->H[$n - 1][$n])) {
691
+					$this->H[$n - 1][$n - 1] = $q / $this->H[$n][$n - 1];
692
+					$this->H[$n - 1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n - 1];
693 693
 				} else {
694
-					$this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q);
695
-					$this->H[$n-1][$n-1] = $this->cdivr;
696
-					$this->H[$n-1][$n]   = $this->cdivi;
694
+					$this->cdiv(0.0, -$this->H[$n - 1][$n], $this->H[$n - 1][$n - 1] - $p, $q);
695
+					$this->H[$n - 1][$n - 1] = $this->cdivr;
696
+					$this->H[$n - 1][$n]   = $this->cdivi;
697 697
 				}
698
-				$this->H[$n][$n-1] = 0.0;
698
+				$this->H[$n][$n - 1] = 0.0;
699 699
 				$this->H[$n][$n] = 1.0;
700
-				for ($i = $n-2; $i >= 0; --$i) {
700
+				for ($i = $n - 2; $i >= 0; --$i) {
701 701
 					// double ra,sa,vr,vi;
702 702
 					$ra = 0.0;
703 703
 					$sa = 0.0;
704 704
 					for ($j = $l; $j <= $n; ++$j) {
705
-						$ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1];
705
+						$ra = $ra + $this->H[$i][$j] * $this->H[$j][$n - 1];
706 706
 						$sa = $sa + $this->H[$i][$j] * $this->H[$j][$n];
707 707
 					}
708 708
 					$w = $this->H[$i][$i] - $p;
@@ -714,34 +714,34 @@  discard block
 block discarded – undo
714 714
 						$l = $i;
715 715
 						if ($this->e[$i] == 0) {
716 716
 							$this->cdiv(-$ra, -$sa, $w, $q);
717
-							$this->H[$i][$n-1] = $this->cdivr;
717
+							$this->H[$i][$n - 1] = $this->cdivr;
718 718
 							$this->H[$i][$n]   = $this->cdivi;
719 719
 						} else {
720 720
 							// Solve complex equations
721
-							$x = $this->H[$i][$i+1];
722
-							$y = $this->H[$i+1][$i];
721
+							$x = $this->H[$i][$i + 1];
722
+							$y = $this->H[$i + 1][$i];
723 723
 							$vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q;
724 724
 							$vi = ($this->d[$i] - $p) * 2.0 * $q;
725 725
 							if ($vr == 0.0 & $vi == 0.0) {
726 726
 								$vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z));
727 727
 							}
728 728
 							$this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi);
729
-							$this->H[$i][$n-1] = $this->cdivr;
729
+							$this->H[$i][$n - 1] = $this->cdivr;
730 730
 							$this->H[$i][$n]   = $this->cdivi;
731 731
 							if (abs($x) > (abs($z) + abs($q))) {
732
-								$this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x;
733
-								$this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x;
732
+								$this->H[$i + 1][$n - 1] = (-$ra - $w * $this->H[$i][$n - 1] + $q * $this->H[$i][$n]) / $x;
733
+								$this->H[$i + 1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n - 1]) / $x;
734 734
 							} else {
735
-								$this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q);
736
-								$this->H[$i+1][$n-1] = $this->cdivr;
737
-								$this->H[$i+1][$n]   = $this->cdivi;
735
+								$this->cdiv(-$r - $y * $this->H[$i][$n - 1], -$s - $y * $this->H[$i][$n], $z, $q);
736
+								$this->H[$i + 1][$n - 1] = $this->cdivr;
737
+								$this->H[$i + 1][$n]   = $this->cdivi;
738 738
 							}
739 739
 						}
740 740
 						// Overflow control
741
-						$t = max(abs($this->H[$i][$n-1]),abs($this->H[$i][$n]));
741
+						$t = max(abs($this->H[$i][$n - 1]), abs($this->H[$i][$n]));
742 742
 						if (($eps * $t) * $t > 1) {
743 743
 							for ($j = $i; $j <= $n; ++$j) {
744
-								$this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
744
+								$this->H[$j][$n - 1] = $this->H[$j][$n - 1] / $t;
745 745
 								$this->H[$j][$n]   = $this->H[$j][$n] / $t;
746 746
 							}
747 747
 						}
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 		}
761 761
 
762 762
 		// Back transformation to get eigenvectors of original matrix
763
-		for ($j = $nn-1; $j >= $low; --$j) {
763
+		for ($j = $nn - 1; $j >= $low; --$j) {
764 764
 			for ($i = $low; $i <= $high; ++$i) {
765 765
 				$z = 0.0;
766
-				for ($k = $low; $k <= min($j,$high); ++$k) {
766
+				for ($k = $low; $k <= min($j, $high); ++$k) {
767 767
 					$z = $z + $this->V[$i][$k] * $this->H[$k][$j];
768 768
 				}
769 769
 				$this->V[$i][$j] = $z;
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -196,8 +196,9 @@  discard block
 block discarded – undo
196 196
 			$tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
197 197
 			$m = $l;
198 198
 			while ($m < $this->n) {
199
-				if (abs($this->e[$m]) <= $eps * $tst1)
200
-					break;
199
+				if (abs($this->e[$m]) <= $eps * $tst1) {
200
+									break;
201
+				}
201 202
 				++$m;
202 203
 			}
203 204
 			// If m == l, $this->d[l] is an eigenvalue,
@@ -211,14 +212,16 @@  discard block
 block discarded – undo
211 212
 					$g = $this->d[$l];
212 213
 					$p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
213 214
 					$r = hypo($p, 1.0);
214
-					if ($p < 0)
215
-						$r *= -1;
215
+					if ($p < 0) {
216
+											$r *= -1;
217
+					}
216 218
 					$this->d[$l] = $this->e[$l] / ($p + $r);
217 219
 					$this->d[$l+1] = $this->e[$l] * ($p + $r);
218 220
 					$dl1 = $this->d[$l+1];
219 221
 					$h = $g - $this->d[$l];
220
-					for ($i = $l + 2; $i < $this->n; ++$i)
221
-						$this->d[$i] -= $h;
222
+					for ($i = $l + 2; $i < $this->n; ++$i) {
223
+											$this->d[$i] -= $h;
224
+					}
222 225
 					$f += $h;
223 226
 					// Implicit QL transformation.
224 227
 					$p = $this->d[$m];
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/SingularValueDecomposition.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  *	@license PHP v3.0
18 18
  *	@version 1.1
19 19
  */
20
-class SingularValueDecomposition  {
20
+class SingularValueDecomposition {
21 21
 
22 22
 	/**
23 23
 	 *	Internal storage of U.
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// Reduce A to bidiagonal form, storing the diagonal elements
76 76
 		// in s and the super-diagonal elements in e.
77
-		for ($k = 0; $k < max($nct,$nrt); ++$k) {
77
+		for ($k = 0; $k < max($nct, $nrt); ++$k) {
78 78
 
79 79
 			if ($k < $nct) {
80 80
 				// Compute the transformation for the k-th column and
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 					$e[$k] = hypo($e[$k], $e[$i]);
131 131
 				}
132 132
 				if ($e[$k] != 0.0) {
133
-					if ($e[$k+1] < 0.0) {
133
+					if ($e[$k + 1] < 0.0) {
134 134
 						$e[$k] = -$e[$k];
135 135
 					}
136 136
 					for ($i = $k + 1; $i < $this->n; ++$i) {
137 137
 						$e[$i] /= $e[$k];
138 138
 					}
139
-					$e[$k+1] += 1.0;
139
+					$e[$k + 1] += 1.0;
140 140
 				}
141 141
 				$e[$k] = -$e[$k];
142
-				if (($k+1 < $this->m) AND ($e[$k] != 0.0)) {
142
+				if (($k + 1 < $this->m) AND ($e[$k] != 0.0)) {
143 143
 					// Apply the transformation.
144
-					for ($i = $k+1; $i < $this->m; ++$i) {
144
+					for ($i = $k + 1; $i < $this->m; ++$i) {
145 145
 						$work[$i] = 0.0;
146 146
 					}
147
-					for ($j = $k+1; $j < $this->n; ++$j) {
148
-						for ($i = $k+1; $i < $this->m; ++$i) {
147
+					for ($j = $k + 1; $j < $this->n; ++$j) {
148
+						for ($i = $k + 1; $i < $this->m; ++$i) {
149 149
 							$work[$i] += $e[$j] * $A[$i][$j];
150 150
 						}
151 151
 					}
152 152
 					for ($j = $k + 1; $j < $this->n; ++$j) {
153
-						$t = -$e[$j] / $e[$k+1];
153
+						$t = -$e[$j] / $e[$k + 1];
154 154
 						for ($i = $k + 1; $i < $this->m; ++$i) {
155 155
 							$A[$i][$j] += $t * $work[$i];
156 156
 						}
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 			$this->s[$nct] = $A[$nct][$nct];
173 173
 		}
174 174
 		if ($this->m < $p) {
175
-			$this->s[$p-1] = 0.0;
175
+			$this->s[$p - 1] = 0.0;
176 176
 		}
177 177
 		if ($nrt + 1 < $p) {
178
-			$e[$nrt] = $A[$nrt][$p-1];
178
+			$e[$nrt] = $A[$nrt][$p - 1];
179 179
 		}
180
-		$e[$p-1] = 0.0;
180
+		$e[$p - 1] = 0.0;
181 181
 		// If required, generate U.
182 182
 		if ($wantu) {
183 183
 			for ($j = $nct; $j < $nu; ++$j) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 							$this->U[$i][$j] += $t * $this->U[$i][$k];
199 199
 						}
200 200
 					}
201
-					for ($i = $k; $i < $this->m; ++$i ) {
201
+					for ($i = $k; $i < $this->m; ++$i) {
202 202
 						$this->U[$i][$k] = -$this->U[$i][$k];
203 203
 					}
204 204
 					$this->U[$k][$k] = 1.0 + $this->U[$k][$k];
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 					for ($j = $k + 1; $j < $nu; ++$j) {
222 222
 						$t = 0;
223 223
 						for ($i = $k + 1; $i < $this->n; ++$i) {
224
-							$t += $this->V[$i][$k]* $this->V[$i][$j];
224
+							$t += $this->V[$i][$k] * $this->V[$i][$j];
225 225
 						}
226
-						$t = -$t / $this->V[$k+1][$k];
226
+						$t = -$t / $this->V[$k + 1][$k];
227 227
 						for ($i = $k + 1; $i < $this->n; ++$i) {
228 228
 							$this->V[$i][$j] += $t * $this->V[$i][$k];
229 229
 						}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				if ($k == -1) {
256 256
 					break;
257 257
 				}
258
-				if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) {
258
+				if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k + 1]))) {
259 259
 					$e[$k] = 0.0;
260 260
 					break;
261 261
 				}
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
 					if ($ks == $k) {
268 268
 						break;
269 269
 					}
270
-					$t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
271
-					if (abs($this->s[$ks]) <= $eps * $t)  {
270
+					$t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks - 1]) : 0.);
271
+					if (abs($this->s[$ks]) <= $eps * $t) {
272 272
 						$this->s[$ks] = 0.0;
273 273
 						break;
274 274
 					}
275 275
 				}
276 276
 				if ($ks == $k) {
277 277
 					$kase = 3;
278
-				} else if ($ks == $p-1) {
278
+				} else if ($ks == $p - 1) {
279 279
 					$kase = 1;
280 280
 				} else {
281 281
 					$kase = 2;
@@ -288,21 +288,21 @@  discard block
 block discarded – undo
288 288
 			switch ($kase) {
289 289
 				// Deflate negligible s(p).
290 290
 				case 1:
291
-						$f = $e[$p-2];
292
-						$e[$p-2] = 0.0;
291
+						$f = $e[$p - 2];
292
+						$e[$p - 2] = 0.0;
293 293
 						for ($j = $p - 2; $j >= $k; --$j) {
294
-							$t  = hypo($this->s[$j],$f);
294
+							$t  = hypo($this->s[$j], $f);
295 295
 							$cs = $this->s[$j] / $t;
296 296
 							$sn = $f / $t;
297 297
 							$this->s[$j] = $t;
298 298
 							if ($j != $k) {
299
-								$f = -$sn * $e[$j-1];
300
-								$e[$j-1] = $cs * $e[$j-1];
299
+								$f = -$sn * $e[$j - 1];
300
+								$e[$j - 1] = $cs * $e[$j - 1];
301 301
 							}
302 302
 							if ($wantv) {
303 303
 								for ($i = 0; $i < $this->n; ++$i) {
304
-									$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
305
-									$this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
304
+									$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p - 1];
305
+									$this->V[$i][$p - 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p - 1];
306 306
 									$this->V[$i][$j] = $t;
307 307
 								}
308 308
 							}
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
 						break;
311 311
 				// Split at negligible s(k).
312 312
 				case 2:
313
-						$f = $e[$k-1];
314
-						$e[$k-1] = 0.0;
313
+						$f = $e[$k - 1];
314
+						$e[$k - 1] = 0.0;
315 315
 						for ($j = $k; $j < $p; ++$j) {
316 316
 							$t = hypo($this->s[$j], $f);
317 317
 							$cs = $this->s[$j] / $t;
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 							$e[$j] = $cs * $e[$j];
322 322
 							if ($wantu) {
323 323
 								for ($i = 0; $i < $this->m; ++$i) {
324
-									$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
325
-									$this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
324
+									$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k - 1];
325
+									$this->U[$i][$k - 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k - 1];
326 326
 									$this->U[$i][$j] = $t;
327 327
 								}
328 328
 							}
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 				case 3:
333 333
 						// Calculate the shift.
334 334
 						$scale = max(max(max(max(
335
-									abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])),
335
+									abs($this->s[$p - 1]), abs($this->s[$p - 2])), abs($e[$p - 2])),
336 336
 									abs($this->s[$k])), abs($e[$k]));
337
-						$sp   = $this->s[$p-1] / $scale;
338
-						$spm1 = $this->s[$p-2] / $scale;
339
-						$epm1 = $e[$p-2] / $scale;
337
+						$sp   = $this->s[$p - 1] / $scale;
338
+						$spm1 = $this->s[$p - 2] / $scale;
339
+						$epm1 = $e[$p - 2] / $scale;
340 340
 						$sk   = $this->s[$k] / $scale;
341 341
 						$ek   = $e[$k] / $scale;
342 342
 						$b    = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
@@ -352,41 +352,41 @@  discard block
 block discarded – undo
352 352
 						$f = ($sk + $sp) * ($sk - $sp) + $shift;
353 353
 						$g = $sk * $ek;
354 354
 						// Chase zeros.
355
-						for ($j = $k; $j < $p-1; ++$j) {
356
-							$t  = hypo($f,$g);
357
-							$cs = $f/$t;
358
-							$sn = $g/$t;
355
+						for ($j = $k; $j < $p - 1; ++$j) {
356
+							$t  = hypo($f, $g);
357
+							$cs = $f / $t;
358
+							$sn = $g / $t;
359 359
 							if ($j != $k) {
360
-								$e[$j-1] = $t;
360
+								$e[$j - 1] = $t;
361 361
 							}
362 362
 							$f = $cs * $this->s[$j] + $sn * $e[$j];
363 363
 							$e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
364
-							$g = $sn * $this->s[$j+1];
365
-							$this->s[$j+1] = $cs * $this->s[$j+1];
364
+							$g = $sn * $this->s[$j + 1];
365
+							$this->s[$j + 1] = $cs * $this->s[$j + 1];
366 366
 							if ($wantv) {
367 367
 								for ($i = 0; $i < $this->n; ++$i) {
368
-									$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
369
-									$this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
368
+									$t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j + 1];
369
+									$this->V[$i][$j + 1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j + 1];
370 370
 									$this->V[$i][$j] = $t;
371 371
 								}
372 372
 							}
373
-							$t = hypo($f,$g);
374
-							$cs = $f/$t;
375
-							$sn = $g/$t;
373
+							$t = hypo($f, $g);
374
+							$cs = $f / $t;
375
+							$sn = $g / $t;
376 376
 							$this->s[$j] = $t;
377
-							$f = $cs * $e[$j] + $sn * $this->s[$j+1];
378
-							$this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
379
-							$g = $sn * $e[$j+1];
380
-							$e[$j+1] = $cs * $e[$j+1];
377
+							$f = $cs * $e[$j] + $sn * $this->s[$j + 1];
378
+							$this->s[$j + 1] = -$sn * $e[$j] + $cs * $this->s[$j + 1];
379
+							$g = $sn * $e[$j + 1];
380
+							$e[$j + 1] = $cs * $e[$j + 1];
381 381
 							if ($wantu && ($j < $this->m - 1)) {
382 382
 								for ($i = 0; $i < $this->m; ++$i) {
383
-									$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
384
-									$this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
383
+									$t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j + 1];
384
+									$this->U[$i][$j + 1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j + 1];
385 385
 									$this->U[$i][$j] = $t;
386 386
 								}
387 387
 							}
388 388
 						}
389
-						$e[$p-2] = $f;
389
+						$e[$p - 2] = $f;
390 390
 						$iter = $iter + 1;
391 391
 						break;
392 392
 				// Convergence.
@@ -402,23 +402,23 @@  discard block
 block discarded – undo
402 402
 						}
403 403
 						// Order the singular values.
404 404
 						while ($k < $pp) {
405
-							if ($this->s[$k] >= $this->s[$k+1]) {
405
+							if ($this->s[$k] >= $this->s[$k + 1]) {
406 406
 								break;
407 407
 							}
408 408
 							$t = $this->s[$k];
409
-							$this->s[$k] = $this->s[$k+1];
410
-							$this->s[$k+1] = $t;
409
+							$this->s[$k] = $this->s[$k + 1];
410
+							$this->s[$k + 1] = $t;
411 411
 							if ($wantv AND ($k < $this->n - 1)) {
412 412
 								for ($i = 0; $i < $this->n; ++$i) {
413
-									$t = $this->V[$i][$k+1];
414
-									$this->V[$i][$k+1] = $this->V[$i][$k];
413
+									$t = $this->V[$i][$k + 1];
414
+									$this->V[$i][$k + 1] = $this->V[$i][$k];
415 415
 									$this->V[$i][$k] = $t;
416 416
 								}
417 417
 							}
418
-							if ($wantu AND ($k < $this->m-1)) {
418
+							if ($wantu AND ($k < $this->m - 1)) {
419 419
 								for ($i = 0; $i < $this->m; ++$i) {
420
-									$t = $this->U[$i][$k+1];
421
-									$this->U[$i][$k+1] = $this->U[$i][$k];
420
+									$t = $this->U[$i][$k + 1];
421
+									$this->U[$i][$k + 1] = $this->U[$i][$k];
422 422
 									$this->U[$i][$k] = $t;
423 423
 								}
424 424
 							}
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/docs/download.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
25 25
 
26 26
 $tarPath = $buildDir.$pkgName."/downloads/".$tarName;
27 27
 
28
-if($_GET['op'] == "download") {  
28
+if ($_GET['op'] == "download") {  
29 29
   
30 30
 	require_once('Archive/Tar.php');  
31 31
 	
32
-	$tar   = new Archive_Tar($tarPath);
32
+	$tar = new Archive_Tar($tarPath);
33 33
 
34 34
   // create $pkgName archive under $pkgName folder
35 35
   $files = glob("$pkgName/*.php");
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/docs/package.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
   $files = glob("*.php");
12 12
   $files = array_merge($files, glob("util/*.php"));
13 13
   foreach ($files as $fileName) {
14
-    ?>
14
+	?>
15 15
   	<li><a href="package.php?view=<?php echo sha1($fileName);?>"><?php echo $fileName;?></a>&nbsp;-&nbsp;<?php echo date ("F d Y - g:i a", filemtime($fileName));?></li>
16 16
     <?php
17 17
   }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
   $files = array_merge($files, glob("util/*.php"));
13 13
   foreach ($files as $fileName) {
14 14
     ?>
15
-  	<li><a href="package.php?view=<?php echo sha1($fileName);?>"><?php echo $fileName;?></a>&nbsp;-&nbsp;<?php echo date ("F d Y - g:i a", filemtime($fileName));?></li>
15
+  	<li><a href="package.php?view=<?php echo sha1($fileName); ?>"><?php echo $fileName; ?></a>&nbsp;-&nbsp;<?php echo date("F d Y - g:i a", filemtime($fileName)); ?></li>
16 16
     <?php
17 17
   }
18 18
   ?>
19 19
 </ul>
20 20
 <?php
21
-if( isset($_REQUEST['view']) ) {
21
+if (isset($_REQUEST['view'])) {
22 22
 	$hash = $_REQUEST['view'];
23 23
 	$n = array_search($hash, array_map(sha1, $files));
24 24
 	$fileName = $files[$n];
25 25
   ?>
26 26
   <hr />  
27
-	Viewing: <?php echo $fileName;?>	
27
+	Viewing: <?php echo $fileName; ?>	
28 28
 	<hr />
29 29
 	<?php
30 30
 	highlight_file($fileName);
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/examples/LagrangeInterpolation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@
 block discarded – undo
23 23
 	public function findPolynomialFactors($x, $y) {
24 24
 		$n = count($x);
25 25
 
26
-		$data = array();  // double[n][n];
27
-		$rhs  = array();  // double[n];
26
+		$data = array(); // double[n][n];
27
+		$rhs  = array(); // double[n];
28 28
 
29 29
 		for ($i = 0; $i < $n; ++$i) {
30 30
 			$v = 1;
31 31
 			for ($j = 0; $j < $n; ++$j) {
32
-				$data[$i][$n-$j-1] = $v;
32
+				$data[$i][$n - $j - 1] = $v;
33 33
 				$v *= $x[$i];
34 34
 			}
35 35
 			$rhs[$i] = $y[$i];
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/examples/MagicSquareExample.php 3 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -11,94 +11,94 @@  discard block
 block discarded – undo
11 11
 class MagicSquareExample {
12 12
 
13 13
   /**
14
-  * Generate magic square test matrix.
15
-  * @param int n dimension of matrix
16
-  */
14
+   * Generate magic square test matrix.
15
+   * @param int n dimension of matrix
16
+   */
17 17
   function magic($n) {
18 18
 
19
-    // Odd order
20
-
21
-    if (($n % 2) == 1) {
22
-      $a = ($n+1)/2;
23
-      $b = ($n+1);
24
-      for ($j = 0; $j < $n; ++$j)
25
-        for ($i = 0; $i < $n; ++$i)
26
-          $M[$i][$j] = $n*(($i+$j+$a) % $n) + (($i+2*$j+$b) % $n) + 1;
27
-
28
-    // Doubly Even Order
29
-
30
-    } else if (($n % 4) == 0) {
31
-      for ($j = 0; $j < $n; ++$j) {
32
-        for ($i = 0; $i < $n; ++$i) {
33
-          if ((($i+1)/2)%2 == (($j+1)/2)%2)
34
-            $M[$i][$j] = $n*$n-$n*$i-$j;
35
-          else
36
-            $M[$i][$j] = $n*$i+$j+1;
37
-        }
38
-      }
39
-
40
-    // Singly Even Order
41
-
42
-    } else {
43
-
44
-      $p = $n/2;
45
-      $k = ($n-2)/4;
46
-      $A = $this->magic($p);
47
-      $M = array();
48
-      for ($j = 0; $j < $p; ++$j) {
49
-        for ($i = 0; $i < $p; ++$i) {
50
-          $aij = $A->get($i,$j);
51
-          $M[$i][$j]       = $aij;
52
-          $M[$i][$j+$p]    = $aij + 2*$p*$p;
53
-          $M[$i+$p][$j]    = $aij + 3*$p*$p;
54
-          $M[$i+$p][$j+$p] = $aij + $p*$p;
55
-        }
56
-      }
57
-
58
-      for ($i = 0; $i < $p; ++$i) {
59
-        for ($j = 0; $j < $k; ++$j) {
60
-          $t = $M[$i][$j];
61
-          $M[$i][$j] = $M[$i+$p][$j];
62
-          $M[$i+$p][$j] = $t;
63
-        }
64
-        for ($j = $n-$k+1; $j < $n; ++$j) {
65
-          $t = $M[$i][$j];
66
-          $M[$i][$j] = $M[$i+$p][$j];
67
-          $M[$i+$p][$j] = $t;
68
-        }
69
-      }
70
-
71
-      $t = $M[$k][0];  $M[$k][0]  = $M[$k+$p][0];  $M[$k+$p][0]  = $t;
72
-      $t = $M[$k][$k]; $M[$k][$k] = $M[$k+$p][$k]; $M[$k+$p][$k] = $t;
73
-
74
-    }
75
-
76
-    return new Matrix($M);
19
+	// Odd order
20
+
21
+	if (($n % 2) == 1) {
22
+	  $a = ($n+1)/2;
23
+	  $b = ($n+1);
24
+	  for ($j = 0; $j < $n; ++$j)
25
+		for ($i = 0; $i < $n; ++$i)
26
+		  $M[$i][$j] = $n*(($i+$j+$a) % $n) + (($i+2*$j+$b) % $n) + 1;
27
+
28
+	// Doubly Even Order
29
+
30
+	} else if (($n % 4) == 0) {
31
+	  for ($j = 0; $j < $n; ++$j) {
32
+		for ($i = 0; $i < $n; ++$i) {
33
+		  if ((($i+1)/2)%2 == (($j+1)/2)%2)
34
+			$M[$i][$j] = $n*$n-$n*$i-$j;
35
+		  else
36
+			$M[$i][$j] = $n*$i+$j+1;
37
+		}
38
+	  }
39
+
40
+	// Singly Even Order
41
+
42
+	} else {
43
+
44
+	  $p = $n/2;
45
+	  $k = ($n-2)/4;
46
+	  $A = $this->magic($p);
47
+	  $M = array();
48
+	  for ($j = 0; $j < $p; ++$j) {
49
+		for ($i = 0; $i < $p; ++$i) {
50
+		  $aij = $A->get($i,$j);
51
+		  $M[$i][$j]       = $aij;
52
+		  $M[$i][$j+$p]    = $aij + 2*$p*$p;
53
+		  $M[$i+$p][$j]    = $aij + 3*$p*$p;
54
+		  $M[$i+$p][$j+$p] = $aij + $p*$p;
55
+		}
56
+	  }
57
+
58
+	  for ($i = 0; $i < $p; ++$i) {
59
+		for ($j = 0; $j < $k; ++$j) {
60
+		  $t = $M[$i][$j];
61
+		  $M[$i][$j] = $M[$i+$p][$j];
62
+		  $M[$i+$p][$j] = $t;
63
+		}
64
+		for ($j = $n-$k+1; $j < $n; ++$j) {
65
+		  $t = $M[$i][$j];
66
+		  $M[$i][$j] = $M[$i+$p][$j];
67
+		  $M[$i+$p][$j] = $t;
68
+		}
69
+	  }
70
+
71
+	  $t = $M[$k][0];  $M[$k][0]  = $M[$k+$p][0];  $M[$k+$p][0]  = $t;
72
+	  $t = $M[$k][$k]; $M[$k][$k] = $M[$k+$p][$k]; $M[$k+$p][$k] = $t;
73
+
74
+	}
75
+
76
+	return new Matrix($M);
77 77
 
78 78
   }
79 79
 
80 80
   /**
81
-  * Simple function to replicate PHP 5 behaviour
82
-  */
81
+   * Simple function to replicate PHP 5 behaviour
82
+   */
83 83
   function microtime_float() {
84
-    list($usec, $sec) = explode(" ", microtime());
85
-    return ((float)$usec + (float)$sec);
84
+	list($usec, $sec) = explode(" ", microtime());
85
+	return ((float)$usec + (float)$sec);
86 86
   }
87 87
 
88 88
   /**
89
-  * Tests LU, QR, SVD and symmetric Eig decompositions.
90
-  *
91
-  *   n       = order of magic square.
92
-  *   trace   = diagonal sum, should be the magic sum, (n^3 + n)/2.
93
-  *   max_eig = maximum eigenvalue of (A + A')/2, should equal trace.
94
-  *   rank    = linear algebraic rank, should equal n if n is odd,
95
-  *             be less than n if n is even.
96
-  *   cond    = L_2 condition number, ratio of singular values.
97
-  *   lu_res  = test of LU factorization, norm1(L*U-A(p,:))/(n*eps).
98
-  *   qr_res  = test of QR factorization, norm1(Q*R-A)/(n*eps).
99
-  */
89
+   * Tests LU, QR, SVD and symmetric Eig decompositions.
90
+   *
91
+   *   n       = order of magic square.
92
+   *   trace   = diagonal sum, should be the magic sum, (n^3 + n)/2.
93
+   *   max_eig = maximum eigenvalue of (A + A')/2, should equal trace.
94
+   *   rank    = linear algebraic rank, should equal n if n is odd,
95
+   *             be less than n if n is even.
96
+   *   cond    = L_2 condition number, ratio of singular values.
97
+   *   lu_res  = test of LU factorization, norm1(L*U-A(p,:))/(n*eps).
98
+   *   qr_res  = test of QR factorization, norm1(Q*R-A)/(n*eps).
99
+   */
100 100
   function main() {
101
-    ?>
101
+	?>
102 102
     <p>Test of Matrix Class, using magic squares.</p>
103 103
     <p>See MagicSquareExample.main() for an explanation.</p>
104 104
     <table border='1' cellspacing='0' cellpadding='4'>
@@ -112,65 +112,65 @@  discard block
 block discarded – undo
112 112
         <th>qr_res</th>
113 113
       </tr>
114 114
       <?php
115
-      $start_time = $this->microtime_float();
116
-      $eps = pow(2.0,-52.0);
117
-      for ($n = 3; $n <= 6; ++$n) {
118
-        echo "<tr>";
115
+	  $start_time = $this->microtime_float();
116
+	  $eps = pow(2.0,-52.0);
117
+	  for ($n = 3; $n <= 6; ++$n) {
118
+		echo "<tr>";
119 119
 
120
-        echo "<td align='right'>$n</td>";
120
+		echo "<td align='right'>$n</td>";
121 121
 
122
-        $M = $this->magic($n);
123
-        $t = (int) $M->trace();
122
+		$M = $this->magic($n);
123
+		$t = (int) $M->trace();
124 124
 
125
-        echo "<td align='right'>$t</td>";
125
+		echo "<td align='right'>$t</td>";
126 126
 
127
-        $O = $M->plus($M->transpose());
128
-        $E = new EigenvalueDecomposition($O->times(0.5));
129
-        $d = $E->getRealEigenvalues();
127
+		$O = $M->plus($M->transpose());
128
+		$E = new EigenvalueDecomposition($O->times(0.5));
129
+		$d = $E->getRealEigenvalues();
130 130
 
131
-        echo "<td align='right'>".$d[$n-1]."</td>";
131
+		echo "<td align='right'>".$d[$n-1]."</td>";
132 132
 
133
-        $r = $M->rank();
133
+		$r = $M->rank();
134 134
 
135
-        echo "<td align='right'>".$r."</td>";
135
+		echo "<td align='right'>".$r."</td>";
136 136
 
137
-        $c = $M->cond();
137
+		$c = $M->cond();
138 138
 
139
-        if ($c < 1/$eps)
140
-          echo "<td align='right'>".sprintf("%.3f",$c)."</td>";
141
-        else
142
-          echo "<td align='right'>Inf</td>";
139
+		if ($c < 1/$eps)
140
+		  echo "<td align='right'>".sprintf("%.3f",$c)."</td>";
141
+		else
142
+		  echo "<td align='right'>Inf</td>";
143 143
 
144
-        $LU = new LUDecomposition($M);
145
-        $L = $LU->getL();
146
-        $U = $LU->getU();
147
-        $p = $LU->getPivot();
148
-        // Java version: R = L.times(U).minus(M.getMatrix(p,0,n-1));
149
-        $S = $L->times($U);
150
-        $R = $S->minus($M->getMatrix($p,0,$n-1));
151
-        $res = $R->norm1()/($n*$eps);
144
+		$LU = new LUDecomposition($M);
145
+		$L = $LU->getL();
146
+		$U = $LU->getU();
147
+		$p = $LU->getPivot();
148
+		// Java version: R = L.times(U).minus(M.getMatrix(p,0,n-1));
149
+		$S = $L->times($U);
150
+		$R = $S->minus($M->getMatrix($p,0,$n-1));
151
+		$res = $R->norm1()/($n*$eps);
152 152
 
153
-        echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
153
+		echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
154 154
 
155
-        $QR = new QRDecomposition($M);
156
-        $Q = $QR->getQ();
157
-        $R = $QR->getR();
158
-        $S = $Q->times($R);
159
-        $R = $S->minus($M);
160
-        $res = $R->norm1()/($n*$eps);
155
+		$QR = new QRDecomposition($M);
156
+		$Q = $QR->getQ();
157
+		$R = $QR->getR();
158
+		$S = $Q->times($R);
159
+		$R = $S->minus($M);
160
+		$res = $R->norm1()/($n*$eps);
161 161
 
162
-        echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
162
+		echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
163 163
 
164
-        echo "</tr>";
164
+		echo "</tr>";
165 165
 
166
-     }
167
-     echo "<table>";
168
-     echo "<br />";
166
+	 }
167
+	 echo "<table>";
168
+	 echo "<br />";
169 169
 
170
-     $stop_time = $this->microtime_float();
171
-     $etime = $stop_time - $start_time;
170
+	 $stop_time = $this->microtime_float();
171
+	 $etime = $stop_time - $start_time;
172 172
 
173
-     echo "<p>Elapsed time is ". sprintf("%.4f",$etime) ." seconds.</p>";
173
+	 echo "<p>Elapsed time is ". sprintf("%.4f",$etime) ." seconds.</p>";
174 174
 
175 175
   }
176 176
 
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@  discard block
 block discarded – undo
19 19
     // Odd order
20 20
 
21 21
     if (($n % 2) == 1) {
22
-      $a = ($n+1)/2;
23
-      $b = ($n+1);
22
+      $a = ($n + 1) / 2;
23
+      $b = ($n + 1);
24 24
       for ($j = 0; $j < $n; ++$j)
25 25
         for ($i = 0; $i < $n; ++$i)
26
-          $M[$i][$j] = $n*(($i+$j+$a) % $n) + (($i+2*$j+$b) % $n) + 1;
26
+          $M[$i][$j] = $n * (($i + $j + $a) % $n) + (($i + 2 * $j + $b) % $n) + 1;
27 27
 
28 28
     // Doubly Even Order
29 29
 
30 30
     } else if (($n % 4) == 0) {
31 31
       for ($j = 0; $j < $n; ++$j) {
32 32
         for ($i = 0; $i < $n; ++$i) {
33
-          if ((($i+1)/2)%2 == (($j+1)/2)%2)
34
-            $M[$i][$j] = $n*$n-$n*$i-$j;
33
+          if ((($i + 1) / 2) % 2 == (($j + 1) / 2) % 2)
34
+            $M[$i][$j] = $n * $n - $n * $i - $j;
35 35
           else
36
-            $M[$i][$j] = $n*$i+$j+1;
36
+            $M[$i][$j] = $n * $i + $j + 1;
37 37
         }
38 38
       }
39 39
 
@@ -41,35 +41,35 @@  discard block
 block discarded – undo
41 41
 
42 42
     } else {
43 43
 
44
-      $p = $n/2;
45
-      $k = ($n-2)/4;
44
+      $p = $n / 2;
45
+      $k = ($n - 2) / 4;
46 46
       $A = $this->magic($p);
47 47
       $M = array();
48 48
       for ($j = 0; $j < $p; ++$j) {
49 49
         for ($i = 0; $i < $p; ++$i) {
50
-          $aij = $A->get($i,$j);
50
+          $aij = $A->get($i, $j);
51 51
           $M[$i][$j]       = $aij;
52
-          $M[$i][$j+$p]    = $aij + 2*$p*$p;
53
-          $M[$i+$p][$j]    = $aij + 3*$p*$p;
54
-          $M[$i+$p][$j+$p] = $aij + $p*$p;
52
+          $M[$i][$j + $p]    = $aij + 2 * $p * $p;
53
+          $M[$i + $p][$j]    = $aij + 3 * $p * $p;
54
+          $M[$i + $p][$j + $p] = $aij + $p * $p;
55 55
         }
56 56
       }
57 57
 
58 58
       for ($i = 0; $i < $p; ++$i) {
59 59
         for ($j = 0; $j < $k; ++$j) {
60 60
           $t = $M[$i][$j];
61
-          $M[$i][$j] = $M[$i+$p][$j];
62
-          $M[$i+$p][$j] = $t;
61
+          $M[$i][$j] = $M[$i + $p][$j];
62
+          $M[$i + $p][$j] = $t;
63 63
         }
64
-        for ($j = $n-$k+1; $j < $n; ++$j) {
64
+        for ($j = $n - $k + 1; $j < $n; ++$j) {
65 65
           $t = $M[$i][$j];
66
-          $M[$i][$j] = $M[$i+$p][$j];
67
-          $M[$i+$p][$j] = $t;
66
+          $M[$i][$j] = $M[$i + $p][$j];
67
+          $M[$i + $p][$j] = $t;
68 68
         }
69 69
       }
70 70
 
71
-      $t = $M[$k][0];  $M[$k][0]  = $M[$k+$p][0];  $M[$k+$p][0]  = $t;
72
-      $t = $M[$k][$k]; $M[$k][$k] = $M[$k+$p][$k]; $M[$k+$p][$k] = $t;
71
+      $t = $M[$k][0]; $M[$k][0]  = $M[$k + $p][0]; $M[$k + $p][0]  = $t;
72
+      $t = $M[$k][$k]; $M[$k][$k] = $M[$k + $p][$k]; $M[$k + $p][$k] = $t;
73 73
 
74 74
     }
75 75
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
   */
83 83
   function microtime_float() {
84 84
     list($usec, $sec) = explode(" ", microtime());
85
-    return ((float)$usec + (float)$sec);
85
+    return ((float) $usec + (float) $sec);
86 86
   }
87 87
 
88 88
   /**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
       </tr>
114 114
       <?php
115 115
       $start_time = $this->microtime_float();
116
-      $eps = pow(2.0,-52.0);
116
+      $eps = pow(2.0, -52.0);
117 117
       for ($n = 3; $n <= 6; ++$n) {
118 118
         echo "<tr>";
119 119
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $E = new EigenvalueDecomposition($O->times(0.5));
129 129
         $d = $E->getRealEigenvalues();
130 130
 
131
-        echo "<td align='right'>".$d[$n-1]."</td>";
131
+        echo "<td align='right'>".$d[$n - 1]."</td>";
132 132
 
133 133
         $r = $M->rank();
134 134
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 
137 137
         $c = $M->cond();
138 138
 
139
-        if ($c < 1/$eps)
140
-          echo "<td align='right'>".sprintf("%.3f",$c)."</td>";
139
+        if ($c < 1 / $eps)
140
+          echo "<td align='right'>".sprintf("%.3f", $c)."</td>";
141 141
         else
142 142
           echo "<td align='right'>Inf</td>";
143 143
 
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
         $p = $LU->getPivot();
148 148
         // Java version: R = L.times(U).minus(M.getMatrix(p,0,n-1));
149 149
         $S = $L->times($U);
150
-        $R = $S->minus($M->getMatrix($p,0,$n-1));
151
-        $res = $R->norm1()/($n*$eps);
150
+        $R = $S->minus($M->getMatrix($p, 0, $n - 1));
151
+        $res = $R->norm1() / ($n * $eps);
152 152
 
153
-        echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
153
+        echo "<td align='right'>".sprintf("%.3f", $res)."</td>";
154 154
 
155 155
         $QR = new QRDecomposition($M);
156 156
         $Q = $QR->getQ();
157 157
         $R = $QR->getR();
158 158
         $S = $Q->times($R);
159 159
         $R = $S->minus($M);
160
-        $res = $R->norm1()/($n*$eps);
160
+        $res = $R->norm1() / ($n * $eps);
161 161
 
162
-        echo "<td align='right'>".sprintf("%.3f",$res)."</td>";
162
+        echo "<td align='right'>".sprintf("%.3f", $res)."</td>";
163 163
 
164 164
         echo "</tr>";
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      $stop_time = $this->microtime_float();
171 171
      $etime = $stop_time - $start_time;
172 172
 
173
-     echo "<p>Elapsed time is ". sprintf("%.4f",$etime) ." seconds.</p>";
173
+     echo "<p>Elapsed time is ".sprintf("%.4f", $etime)." seconds.</p>";
174 174
 
175 175
   }
176 176
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,19 +21,23 @@  discard block
 block discarded – undo
21 21
     if (($n % 2) == 1) {
22 22
       $a = ($n+1)/2;
23 23
       $b = ($n+1);
24
-      for ($j = 0; $j < $n; ++$j)
25
-        for ($i = 0; $i < $n; ++$i)
26
-          $M[$i][$j] = $n*(($i+$j+$a) % $n) + (($i+2*$j+$b) % $n) + 1;
24
+      for ($j = 0; $j < $n; ++$j) {
25
+              for ($i = 0;
26
+      }
27
+      $i < $n; ++$i) {
28
+                  $M[$i][$j] = $n*(($i+$j+$a) % $n) + (($i+2*$j+$b) % $n) + 1;
29
+        }
27 30
 
28 31
     // Doubly Even Order
29 32
 
30 33
     } else if (($n % 4) == 0) {
31 34
       for ($j = 0; $j < $n; ++$j) {
32 35
         for ($i = 0; $i < $n; ++$i) {
33
-          if ((($i+1)/2)%2 == (($j+1)/2)%2)
34
-            $M[$i][$j] = $n*$n-$n*$i-$j;
35
-          else
36
-            $M[$i][$j] = $n*$i+$j+1;
36
+          if ((($i+1)/2)%2 == (($j+1)/2)%2) {
37
+                      $M[$i][$j] = $n*$n-$n*$i-$j;
38
+          } else {
39
+                      $M[$i][$j] = $n*$i+$j+1;
40
+          }
37 41
         }
38 42
       }
39 43
 
@@ -136,10 +140,11 @@  discard block
 block discarded – undo
136 140
 
137 141
         $c = $M->cond();
138 142
 
139
-        if ($c < 1/$eps)
140
-          echo "<td align='right'>".sprintf("%.3f",$c)."</td>";
141
-        else
142
-          echo "<td align='right'>Inf</td>";
143
+        if ($c < 1/$eps) {
144
+                  echo "<td align='right'>".sprintf("%.3f",$c)."</td>";
145
+        } else {
146
+                  echo "<td align='right'>Inf</td>";
147
+        }
143 148
 
144 149
         $LU = new LUDecomposition($M);
145 150
         $L = $LU->getL();
Please login to merge, or discard this patch.
app/Vendor/PHPExcel/PHPExcel/Shared/JAMA/examples/benchmark.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	function microtime_float() {
24 24
 		list($usec, $sec) = explode(" ", microtime());
25 25
 
26
-		return ((float)$usec + (float)$sec);
26
+		return ((float) $usec + (float) $sec);
27 27
 	}	//	function microtime_float()
28 28
 
29 29
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		$stats = $this->stat->calcFull();
33 33
 
34 34
 		echo '<table style="margin-left:32px;">';
35
-		echo '<tr><td style="text-align:right;"><b>n:</b><td style="text-align:right;">' . $stats['count'] . ' </td></tr>';
36
-		echo '<tr><td style="text-align:right;"><b>Mean:</b><td style="text-align:right;">' . $stats['mean'] . ' </td></tr>';
37
-		echo '<tr><td style="text-align:right;"><b>Min.:</b><td style="text-align:right;">' . $stats['min'] . ' </td></tr>';
38
-		echo '<tr><td style="text-align:right;"><b>Max.:</b><td style="text-align:right;">' . $stats['max'] . ' </td></tr>';
39
-		echo '<tr><td style="text-align:right;"><b>&sigma;:</b><td style="text-align:right;">' . $stats['stdev'] . ' </td></tr>';
40
-		echo '<tr><td style="text-align:right;"><b>Variance:</b><td style="text-align:right;">' . $stats['variance'] . ' </td></tr>';
41
-		echo '<tr><td style="text-align:right;"><b>Range:</b><td style="text-align:right;">' . $stats['range'] . ' </td></tr>';
35
+		echo '<tr><td style="text-align:right;"><b>n:</b><td style="text-align:right;">'.$stats['count'].' </td></tr>';
36
+		echo '<tr><td style="text-align:right;"><b>Mean:</b><td style="text-align:right;">'.$stats['mean'].' </td></tr>';
37
+		echo '<tr><td style="text-align:right;"><b>Min.:</b><td style="text-align:right;">'.$stats['min'].' </td></tr>';
38
+		echo '<tr><td style="text-align:right;"><b>Max.:</b><td style="text-align:right;">'.$stats['max'].' </td></tr>';
39
+		echo '<tr><td style="text-align:right;"><b>&sigma;:</b><td style="text-align:right;">'.$stats['stdev'].' </td></tr>';
40
+		echo '<tr><td style="text-align:right;"><b>Variance:</b><td style="text-align:right;">'.$stats['variance'].' </td></tr>';
41
+		echo '<tr><td style="text-align:right;"><b>Range:</b><td style="text-align:right;">'.$stats['range'].' </td></tr>';
42 42
 		echo '</table>';
43 43
 
44 44
 		return $stats;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 $benchmark = new Benchmark();
167 167
 
168
-switch($_REQUEST['decomposition']) {
168
+switch ($_REQUEST['decomposition']) {
169 169
 	case 'cholesky':
170 170
 		$m = array();
171 171
 		for ($i = 2; $i <= 8; $i *= 2) {
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 			echo "<br />";
177 177
 		}
178 178
 		echo '<pre>';
179
-		foreach($m as $x => $y) {
180
-			echo "$x\t" . 1000*$y . "\n";
179
+		foreach ($m as $x => $y) {
180
+			echo "$x\t".1000 * $y."\n";
181 181
 		}
182 182
 		echo '</pre>';
183 183
 		break;
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 			echo "<br />";
192 192
 		}
193 193
 		echo '<pre>';
194
-		foreach($m as $x => $y) {
195
-			echo "$x\t" . 1000*$y . "\n";
194
+		foreach ($m as $x => $y) {
195
+			echo "$x\t".1000 * $y."\n";
196 196
 		}
197 197
 		echo '</pre>';
198 198
 		break;
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 			echo "<br />";
207 207
 		}
208 208
 		echo '<pre>';
209
-		foreach($m as $x => $y) {
210
-			echo "$x\t" . 1000*$y . "\n";
209
+		foreach ($m as $x => $y) {
210
+			echo "$x\t".1000 * $y."\n";
211 211
 		}
212 212
 		echo '</pre>';
213 213
 		break;
@@ -221,14 +221,14 @@  discard block
 block discarded – undo
221 221
 			echo "<br />";
222 222
 		}
223 223
 		echo '<pre>';
224
-		foreach($m as $x => $y) {
225
-			echo "$x\t" . 1000*$y . "\n";
224
+		foreach ($m as $x => $y) {
225
+			echo "$x\t".1000 * $y."\n";
226 226
 		}
227 227
 		echo '</pre>';
228 228
 		break;
229 229
 	case 'svd':
230 230
 		$m = array();
231
-		for($i = 2; $i <= 8; $i *= 2) {
231
+		for ($i = 2; $i <= 8; $i *= 2) {
232 232
 			$t = 32 / $i;
233 233
 			echo "<b>Singular value decomposition: $t random {$i}x{$i} matrices</b><br />";
234 234
 			$s = $benchmark->displayStats($benchmark->runSVD($i, $t));
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 			echo "<br />";
237 237
 		}
238 238
 		echo '<pre>';
239
-		foreach($m as $x => $y) {
240
-			echo "$x\t" . 1000*$y . "\n";
239
+		foreach ($m as $x => $y) {
240
+			echo "$x\t".1000 * $y."\n";
241 241
 		}
242 242
 		echo '</pre>';
243 243
 		break;
Please login to merge, or discard this patch.