@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | /** PHPExcel root directory */ |
| 29 | -if (!defined('PHPEXCEL_ROOT')) { |
|
| 29 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
| 30 | 30 | /** |
| 31 | 31 | * @ignore |
| 32 | 32 | */ |
| 33 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); |
|
| 34 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
| 33 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../'); |
|
| 34 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | /** constants */ |
| 41 | 41 | /** Available Zip library classes */ |
| 42 | - const PCLZIP = 'PHPExcel_Shared_ZipArchive'; |
|
| 43 | - const ZIPARCHIVE = 'ZipArchive'; |
|
| 42 | + const PCLZIP = 'PHPExcel_Shared_ZipArchive'; |
|
| 43 | + const ZIPARCHIVE = 'ZipArchive'; |
|
| 44 | 44 | |
| 45 | 45 | /** Optional Chart Rendering libraries */ |
| 46 | - const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
| 46 | + const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
| 47 | 47 | |
| 48 | 48 | /** Optional PDF Rendering libraries */ |
| 49 | 49 | const PDF_RENDERER_TCPDF = 'tcpdf'; |
| 50 | - const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
| 50 | + const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
| 51 | 51 | const PDF_RENDERER_MPDF = 'mpdf'; |
| 52 | 52 | |
| 53 | 53 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @var string |
| 71 | 71 | */ |
| 72 | - private static $_zipClass = self::ZIPARCHIVE; |
|
| 72 | + private static $_zipClass = self::ZIPARCHIVE; |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | * @param string $locale The locale code to use (e.g. "fr" or "pt_br" or "en_uk") |
| 176 | 176 | * @return boolean Success or failure |
| 177 | 177 | */ |
| 178 | - public static function setLocale($locale='en_us') { |
|
| 178 | + public static function setLocale($locale = 'en_us') { |
|
| 179 | 179 | return PHPExcel_Calculation::getInstance()->setLocale($locale); |
| 180 | 180 | } // function setLocale() |
| 181 | 181 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * @return boolean Success or failure |
| 190 | 190 | */ |
| 191 | 191 | public static function setChartRenderer($libraryName, $libraryBaseDir) { |
| 192 | - if (!self::setChartRendererName($libraryName)) |
|
| 192 | + if ( ! self::setChartRendererName($libraryName)) |
|
| 193 | 193 | return FALSE; |
| 194 | 194 | return self::setChartRendererPath($libraryBaseDir); |
| 195 | 195 | } // function setChartRenderer() |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @return boolean Success or failure |
| 204 | 204 | */ |
| 205 | 205 | public static function setChartRendererName($libraryName) { |
| 206 | - if (!in_array($libraryName,self::$_chartRenderers)) { |
|
| 206 | + if ( ! in_array($libraryName, self::$_chartRenderers)) { |
|
| 207 | 207 | return FALSE; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return boolean Success or failure |
| 261 | 261 | */ |
| 262 | 262 | public static function setPdfRenderer($libraryName, $libraryBaseDir) { |
| 263 | - if (!self::setPdfRendererName($libraryName)) |
|
| 263 | + if ( ! self::setPdfRendererName($libraryName)) |
|
| 264 | 264 | return FALSE; |
| 265 | 265 | return self::setPdfRendererPath($libraryBaseDir); |
| 266 | 266 | } // function setPdfRenderer() |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @return boolean Success or failure |
| 277 | 277 | */ |
| 278 | 278 | public static function setPdfRendererName($libraryName) { |
| 279 | - if (!in_array($libraryName,self::$_pdfRenderers)) { |
|
| 279 | + if ( ! in_array($libraryName, self::$_pdfRenderers)) { |
|
| 280 | 280 | return FALSE; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -189,8 +189,9 @@ discard block |
||
| 189 | 189 | * @return boolean Success or failure |
| 190 | 190 | */ |
| 191 | 191 | public static function setChartRenderer($libraryName, $libraryBaseDir) { |
| 192 | - if (!self::setChartRendererName($libraryName)) |
|
| 193 | - return FALSE; |
|
| 192 | + if (!self::setChartRendererName($libraryName)) { |
|
| 193 | + return FALSE; |
|
| 194 | + } |
|
| 194 | 195 | return self::setChartRendererPath($libraryBaseDir); |
| 195 | 196 | } // function setChartRenderer() |
| 196 | 197 | |
@@ -260,8 +261,9 @@ discard block |
||
| 260 | 261 | * @return boolean Success or failure |
| 261 | 262 | */ |
| 262 | 263 | public static function setPdfRenderer($libraryName, $libraryBaseDir) { |
| 263 | - if (!self::setPdfRendererName($libraryName)) |
|
| 264 | - return FALSE; |
|
| 264 | + if (!self::setPdfRendererName($libraryName)) { |
|
| 265 | + return FALSE; |
|
| 266 | + } |
|
| 265 | 267 | return self::setPdfRendererPath($libraryBaseDir); |
| 266 | 268 | } // function setPdfRenderer() |
| 267 | 269 | |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | const ZIPARCHIVE = 'ZipArchive'; |
| 44 | 44 | |
| 45 | 45 | /** Optional Chart Rendering libraries */ |
| 46 | - const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
| 46 | + const CHART_RENDERER_JPGRAPH = 'jpgraph'; |
|
| 47 | 47 | |
| 48 | 48 | /** Optional PDF Rendering libraries */ |
| 49 | - const PDF_RENDERER_TCPDF = 'tcpdf'; |
|
| 50 | - const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
| 51 | - const PDF_RENDERER_MPDF = 'mpdf'; |
|
| 49 | + const PDF_RENDERER_TCPDF = 'tcpdf'; |
|
| 50 | + const PDF_RENDERER_DOMPDF = 'dompdf'; |
|
| 51 | + const PDF_RENDERER_MPDF = 'mpdf'; |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | private static $_chartRenderers = array( |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE |
| 36 | 36 | { |
| 37 | - const BLIPTYPE_ERROR = 0x00; |
|
| 38 | - const BLIPTYPE_UNKNOWN = 0x01; |
|
| 37 | + const BLIPTYPE_ERROR = 0x00; |
|
| 38 | + const BLIPTYPE_UNKNOWN = 0x01; |
|
| 39 | 39 | const BLIPTYPE_EMF = 0x02; |
| 40 | 40 | const BLIPTYPE_WMF = 0x03; |
| 41 | 41 | const BLIPTYPE_PICT = 0x04; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | const BLIPTYPE_PNG = 0x06; |
| 44 | 44 | const BLIPTYPE_DIB = 0x07; |
| 45 | 45 | const BLIPTYPE_TIFF = 0x11; |
| 46 | - const BLIPTYPE_CMYKJPEG = 0x12; |
|
| 46 | + const BLIPTYPE_CMYKJPEG = 0x12; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * The parent BLIP Store Entry Container |
@@ -36,11 +36,11 @@ |
||
| 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 |
@@ -45,10 +45,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -50,9 +50,9 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -49,21 +49,21 @@ |
||
| 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 | |
@@ -73,15 +73,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -196,8 +196,9 @@ discard block |
||
| 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 |
||
| 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]; |
@@ -17,7 +17,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -25,11 +25,11 @@ |
||
| 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"); |
@@ -11,7 +11,7 @@ |
||
| 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> - <?php echo date ("F d Y - g:i a", filemtime($fileName));?></li> |
| 16 | 16 | <?php |
| 17 | 17 | } |
@@ -12,19 +12,19 @@ |
||
| 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> - <?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> - <?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); |
@@ -24,13 +24,13 @@ |
||
| 24 | 24 | public function findPolynomialFactors($x, $y) { |
| 25 | 25 | $n = count($x); |
| 26 | 26 | |
| 27 | - $data = array(); // double[n][n]; |
|
| 28 | - $rhs = array(); // double[n]; |
|
| 27 | + $data = array(); // double[n][n]; |
|
| 28 | + $rhs = array(); // double[n]; |
|
| 29 | 29 | |
| 30 | 30 | for ($i = 0; $i < $n; ++$i) { |
| 31 | 31 | $v = 1; |
| 32 | 32 | for ($j = 0; $j < $n; ++$j) { |
| 33 | - $data[$i][$n-$j-1] = $v; |
|
| 33 | + $data[$i][$n - $j - 1] = $v; |
|
| 34 | 34 | $v *= $x[$i]; |
| 35 | 35 | } |
| 36 | 36 | $rhs[$i] = $y[$i]; |