@@ -392,7 +392,7 @@ |
||
392 | 392 | /** |
393 | 393 | * Get Contiguous |
394 | 394 | * |
395 | - * @return boolean |
|
395 | + * @return integer |
|
396 | 396 | */ |
397 | 397 | public function getContiguous() |
398 | 398 | { |
@@ -262,8 +262,8 @@ |
||
262 | 262 | $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex); |
263 | 263 | |
264 | 264 | $escapeEnclosures = array( "\\" . $this->enclosure, |
265 | - $this->enclosure . $this->enclosure |
|
266 | - ); |
|
265 | + $this->enclosure . $this->enclosure |
|
266 | + ); |
|
267 | 267 | |
268 | 268 | // Set our starting row based on whether we're in contiguous mode or not |
269 | 269 | $currentRow = 1; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $this->skipBOM(); |
191 | 191 | $this->checkSeparator(); |
192 | 192 | |
193 | - $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure ); |
|
193 | + $escapeEnclosures = array("\\" . $this->enclosure, $this->enclosure . $this->enclosure); |
|
194 | 194 | |
195 | 195 | $worksheetInfo = array(); |
196 | 196 | $worksheetInfo[0]['worksheetName'] = 'Worksheet'; |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | } |
262 | 262 | $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex); |
263 | 263 | |
264 | - $escapeEnclosures = array( "\\" . $this->enclosure, |
|
264 | + $escapeEnclosures = array("\\" . $this->enclosure, |
|
265 | 265 | $this->enclosure . $this->enclosure |
266 | 266 | ); |
267 | 267 | |
268 | 268 | // Set our starting row based on whether we're in contiguous mode or not |
269 | 269 | $currentRow = 1; |
270 | 270 | if ($this->contiguous) { |
271 | - $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow; |
|
271 | + $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow() : $this->contiguousRow; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | // Loop through each line of the file in turn |
@@ -231,6 +231,9 @@ discard block |
||
231 | 231 | return $this->loadIntoExisting($pFilename, $objPHPExcel); |
232 | 232 | } |
233 | 233 | |
234 | + /** |
|
235 | + * @param string $styleAttributeValue |
|
236 | + */ |
|
234 | 237 | protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue) |
235 | 238 | { |
236 | 239 | $styleAttributeValue = strtolower($styleAttributeValue); |
@@ -786,6 +789,9 @@ discard block |
||
786 | 789 | } |
787 | 790 | |
788 | 791 | |
792 | + /** |
|
793 | + * @param string $charset |
|
794 | + */ |
|
789 | 795 | protected static function convertStringEncoding($string, $charset) |
790 | 796 | { |
791 | 797 | if ($charset != 'UTF-8') { |
@@ -285,20 +285,20 @@ discard block |
||
285 | 285 | $fromFormats = array('\-', '\ '); |
286 | 286 | $toFormats = array('-', ' '); |
287 | 287 | |
288 | - $underlineStyles = array ( |
|
288 | + $underlineStyles = array( |
|
289 | 289 | \PhpSpreadsheet\Style\Font::UNDERLINE_NONE, |
290 | 290 | \PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE, |
291 | 291 | \PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLEACCOUNTING, |
292 | 292 | \PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE, |
293 | 293 | \PhpSpreadsheet\Style\Font::UNDERLINE_SINGLEACCOUNTING |
294 | 294 | ); |
295 | - $verticalAlignmentStyles = array ( |
|
295 | + $verticalAlignmentStyles = array( |
|
296 | 296 | \PhpSpreadsheet\Style\Alignment::VERTICAL_BOTTOM, |
297 | 297 | \PhpSpreadsheet\Style\Alignment::VERTICAL_TOP, |
298 | 298 | \PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, |
299 | 299 | \PhpSpreadsheet\Style\Alignment::VERTICAL_JUSTIFY |
300 | 300 | ); |
301 | - $horizontalAlignmentStyles = array ( |
|
301 | + $horizontalAlignmentStyles = array( |
|
302 | 302 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_GENERAL, |
303 | 303 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT, |
304 | 304 | \PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT, |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | foreach ($worksheet->Table->Column as $columnData) { |
553 | 553 | $columnData_ss = $columnData->attributes($namespaces['ss']); |
554 | 554 | if (isset($columnData_ss['Index'])) { |
555 | - $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnData_ss['Index']-1); |
|
555 | + $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnData_ss['Index'] - 1); |
|
556 | 556 | } |
557 | 557 | if (isset($columnData_ss['Width'])) { |
558 | 558 | $columnWidth = $columnData_ss['Width']; |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | foreach ($rowData->Cell as $cell) { |
579 | 579 | $cell_ss = $cell->attributes($namespaces['ss']); |
580 | 580 | if (isset($cell_ss['Index'])) { |
581 | - $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($cell_ss['Index']-1); |
|
581 | + $columnID = \PhpSpreadsheet\Cell::stringFromColumnIndex($cell_ss['Index'] - 1); |
|
582 | 582 | } |
583 | - $cellRange = $columnID.$rowID; |
|
583 | + $cellRange = $columnID . $rowID; |
|
584 | 584 | |
585 | 585 | if ($this->getReadFilter() !== null) { |
586 | 586 | if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) { |
@@ -591,14 +591,14 @@ discard block |
||
591 | 591 | if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) { |
592 | 592 | $columnTo = $columnID; |
593 | 593 | if (isset($cell_ss['MergeAcross'])) { |
594 | - $additionalMergedCells += (int)$cell_ss['MergeAcross']; |
|
595 | - $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1); |
|
594 | + $additionalMergedCells += (int) $cell_ss['MergeAcross']; |
|
595 | + $columnTo = \PhpSpreadsheet\Cell::stringFromColumnIndex(\PhpSpreadsheet\Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] - 1); |
|
596 | 596 | } |
597 | 597 | $rowTo = $rowID; |
598 | 598 | if (isset($cell_ss['MergeDown'])) { |
599 | 599 | $rowTo = $rowTo + $cell_ss['MergeDown']; |
600 | 600 | } |
601 | - $cellRange .= ':'.$columnTo.$rowTo; |
|
601 | + $cellRange .= ':' . $columnTo . $rowTo; |
|
602 | 602 | $spreadsheet->getActiveSheet()->mergeCells($cellRange); |
603 | 603 | } |
604 | 604 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | if ($columnReference{0} == '[') { |
704 | 704 | $columnReference = $columnNumber + trim($columnReference, '[]'); |
705 | 705 | } |
706 | - $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference-1).$rowReference; |
|
706 | + $A1CellReference = \PhpSpreadsheet\Cell::stringFromColumnIndex($columnReference - 1) . $rowReference; |
|
707 | 707 | $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0])); |
708 | 708 | } |
709 | 709 | } |
@@ -717,10 +717,10 @@ discard block |
||
717 | 717 | |
718 | 718 | // echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />'; |
719 | 719 | // |
720 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
720 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type); |
|
721 | 721 | if ($hasCalculatedValue) { |
722 | 722 | // echo 'Formula result is '.$cellValue.'<br />'; |
723 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue); |
|
723 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setCalculatedValue($cellValue); |
|
724 | 724 | } |
725 | 725 | $cellIsSet = $rowHasData = true; |
726 | 726 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $commentAttributes = $cell->Comment->attributes($namespaces['ss']); |
731 | 731 | $author = 'unknown'; |
732 | 732 | if (isset($commentAttributes->Author)) { |
733 | - $author = (string)$commentAttributes->Author; |
|
733 | + $author = (string) $commentAttributes->Author; |
|
734 | 734 | // echo 'Author: ', $author,'<br />'; |
735 | 735 | } |
736 | 736 | $node = $cell->Comment->Data->asXML(); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | // echo $annotation,'<br />'; |
739 | 739 | $annotation = strip_tags($node); |
740 | 740 | // echo 'Annotation: ', $annotation,'<br />'; |
741 | - $spreadsheet->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation)); |
|
741 | + $spreadsheet->getActiveSheet()->getComment($columnID . $rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation)); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | if (($cellIsSet) && (isset($cell_ss['StyleID']))) { |
@@ -748,8 +748,8 @@ discard block |
||
748 | 748 | // echo 'Cell '.$columnID.$rowID.'<br />'; |
749 | 749 | // print_r($this->styles[$style]); |
750 | 750 | // echo '<br />'; |
751 | - if (!$spreadsheet->getActiveSheet()->cellExists($columnID.$rowID)) { |
|
752 | - $spreadsheet->getActiveSheet()->getCell($columnID.$rowID)->setValue(null); |
|
751 | + if (!$spreadsheet->getActiveSheet()->cellExists($columnID . $rowID)) { |
|
752 | + $spreadsheet->getActiveSheet()->getCell($columnID . $rowID)->setValue(null); |
|
753 | 753 | } |
754 | 754 | $spreadsheet->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]); |
755 | 755 | } |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | * |
1212 | 1212 | * @param string $data Data stream to read from |
1213 | 1213 | * @param int $pos Position to start reading from |
1214 | - * @param int $length Record data length |
|
1214 | + * @param integer $len |
|
1215 | 1215 | * |
1216 | 1216 | * @return string Record data |
1217 | 1217 | */ |
@@ -1754,6 +1754,7 @@ discard block |
||
1754 | 1754 | * @var int $block Block for which to create decrypto |
1755 | 1755 | * @var string $valContext MD5 context state |
1756 | 1756 | * |
1757 | + * @param string $valContext |
|
1757 | 1758 | * @return Excel5\RC4 |
1758 | 1759 | */ |
1759 | 1760 | private function makeKey($block, $valContext) |
@@ -1788,6 +1789,11 @@ discard block |
||
1788 | 1789 | * @var string $hashedsalt_data Hashed salt data |
1789 | 1790 | * @var string &$valContext Set to the MD5 context of the value |
1790 | 1791 | * |
1792 | + * @param string $password |
|
1793 | + * @param string $docid |
|
1794 | + * @param string $salt_data |
|
1795 | + * @param string $hashedsalt_data |
|
1796 | + * @param string $valContext |
|
1791 | 1797 | * @return bool Success |
1792 | 1798 | */ |
1793 | 1799 | private function verifyPassword($password, $docid, $salt_data, $hashedsalt_data, &$valContext) |
@@ -5227,7 +5233,7 @@ discard block |
||
5227 | 5233 | * is in one piece. |
5228 | 5234 | * Moves to next current position in data stream to start of next record different from a CONtINUE record |
5229 | 5235 | * |
5230 | - * @return array |
|
5236 | + * @return integer|null |
|
5231 | 5237 | */ |
5232 | 5238 | private function getSplicedRecordData() |
5233 | 5239 | { |
@@ -5331,8 +5337,7 @@ discard block |
||
5331 | 5337 | * Take array of tokens together with additional data for formula and return human readable formula |
5332 | 5338 | * |
5333 | 5339 | * @param array $tokens |
5334 | - * @param array $additionalData Additional binary data going with the formula |
|
5335 | - * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas |
|
5340 | + * @param string $additionalData Additional binary data going with the formula |
|
5336 | 5341 | * @return string Human readable formula |
5337 | 5342 | */ |
5338 | 5343 | private function createFormulaFromTokens($tokens, $additionalData) |
@@ -5496,7 +5501,8 @@ discard block |
||
5496 | 5501 | * |
5497 | 5502 | * @param string Formula data |
5498 | 5503 | * @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas |
5499 | - * @return array |
|
5504 | + * @param string $formulaData |
|
5505 | + * @return string |
|
5500 | 5506 | * @throws Exception |
5501 | 5507 | */ |
5502 | 5508 | private function getNextToken($formulaData, $baseCell = 'A1') |
@@ -7070,7 +7076,7 @@ discard block |
||
7070 | 7076 | * section 2.5.15 |
7071 | 7077 | * |
7072 | 7078 | * @param string $subData |
7073 | - * @return array |
|
7079 | + * @return string |
|
7074 | 7080 | */ |
7075 | 7081 | private function readBIFF8CellRangeAddressList($subData) |
7076 | 7082 | { |
@@ -7463,6 +7469,9 @@ discard block |
||
7463 | 7469 | } |
7464 | 7470 | |
7465 | 7471 | |
7472 | + /** |
|
7473 | + * @param integer $rknum |
|
7474 | + */ |
|
7466 | 7475 | private static function getIEEE754($rknum) |
7467 | 7476 | { |
7468 | 7477 | if (($rknum & 0x02) != 0) { |
@@ -7493,7 +7502,7 @@ discard block |
||
7493 | 7502 | * Get UTF-8 string from (compressed or uncompressed) UTF-16 string |
7494 | 7503 | * |
7495 | 7504 | * @param string $string |
7496 | - * @param bool $compressed |
|
7505 | + * @param string|boolean $compressed |
|
7497 | 7506 | * @return string |
7498 | 7507 | */ |
7499 | 7508 | private static function encodeUTF16($string, $compressed = '') |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | // total byte size of Excel data (workbook global substream + sheet substreams) |
457 | 457 | $this->dataSize = strlen($this->data); |
458 | 458 | |
459 | - $this->pos = 0; |
|
460 | - $this->sheets = array(); |
|
459 | + $this->pos = 0; |
|
460 | + $this->sheets = array(); |
|
461 | 461 | |
462 | 462 | // Parse Workbook Global Substream |
463 | 463 | while ($this->pos < $this->dataSize) { |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | // $range should look like one of these |
1124 | 1124 | // Foo!$C$7:$J$66 |
1125 | 1125 | // Bar!$A$1:$IV$2 |
1126 | - $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
1126 | + $explodes = explode('!', $range); // FIXME: what if sheetname contains exclamation mark? |
|
1127 | 1127 | $sheetName = trim($explodes[0], "'"); |
1128 | 1128 | if (count($explodes) == 2) { |
1129 | 1129 | if (strpos($explodes[1], ':') === false) { |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | $secLength = self::getInt4d($this->summaryInformation, $secOffset); |
1307 | 1307 | |
1308 | 1308 | // offset: $secOffset+4; size: 4; property count |
1309 | - $countProperties = self::getInt4d($this->summaryInformation, $secOffset+4); |
|
1309 | + $countProperties = self::getInt4d($this->summaryInformation, $secOffset + 4); |
|
1310 | 1310 | |
1311 | 1311 | // initialize code page (used to resolve string values) |
1312 | 1312 | $codePage = 'CP1252'; |
@@ -1315,11 +1315,11 @@ discard block |
||
1315 | 1315 | // loop through property decarations and properties |
1316 | 1316 | for ($i = 0; $i < $countProperties; ++$i) { |
1317 | 1317 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
1318 | - $id = self::getInt4d($this->summaryInformation, ($secOffset+8) + (8 * $i)); |
|
1318 | + $id = self::getInt4d($this->summaryInformation, ($secOffset + 8) + (8 * $i)); |
|
1319 | 1319 | |
1320 | 1320 | // Use value of property id as appropriate |
1321 | 1321 | // offset: ($secOffset+12) + (8 * $i); size: 4; offset from beginning of section (48) |
1322 | - $offset = self::getInt4d($this->summaryInformation, ($secOffset+12) + (8 * $i)); |
|
1322 | + $offset = self::getInt4d($this->summaryInformation, ($secOffset + 12) + (8 * $i)); |
|
1323 | 1323 | |
1324 | 1324 | $type = self::getInt4d($this->summaryInformation, $secOffset + $offset); |
1325 | 1325 | |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | // echo '$secLength = ', $secLength,'<br />'; |
1445 | 1445 | |
1446 | 1446 | // offset: $secOffset+4; size: 4; property count |
1447 | - $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset+4); |
|
1447 | + $countProperties = self::getInt4d($this->documentSummaryInformation, $secOffset + 4); |
|
1448 | 1448 | // echo '$countProperties = ', $countProperties,'<br />'; |
1449 | 1449 | |
1450 | 1450 | // initialize code page (used to resolve string values) |
@@ -1455,12 +1455,12 @@ discard block |
||
1455 | 1455 | for ($i = 0; $i < $countProperties; ++$i) { |
1456 | 1456 | // echo 'Property ', $i,'<br />'; |
1457 | 1457 | // offset: ($secOffset+8) + (8 * $i); size: 4; property ID |
1458 | - $id = self::getInt4d($this->documentSummaryInformation, ($secOffset+8) + (8 * $i)); |
|
1458 | + $id = self::getInt4d($this->documentSummaryInformation, ($secOffset + 8) + (8 * $i)); |
|
1459 | 1459 | // echo 'ID is ', $id,'<br />'; |
1460 | 1460 | |
1461 | 1461 | // Use value of property id as appropriate |
1462 | 1462 | // offset: 60 + 8 * $i; size: 4; offset from beginning of section (48) |
1463 | - $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset+12) + (8 * $i)); |
|
1463 | + $offset = self::getInt4d($this->documentSummaryInformation, ($secOffset + 12) + (8 * $i)); |
|
1464 | 1464 | |
1465 | 1465 | $type = self::getInt4d($this->documentSummaryInformation, $secOffset + $offset); |
1466 | 1466 | // echo 'Type is ', $type,', '; |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | // Concatenate this extension with the currently set comment for the cell |
1619 | 1619 | $comment = $this->phpSheet->getComment($cellAddress); |
1620 | 1620 | $commentText = $comment->getText()->getPlainText(); |
1621 | - $comment->setText($this->parseRichText($commentText.$noteText)); |
|
1621 | + $comment->setText($this->parseRichText($commentText . $noteText)); |
|
1622 | 1622 | } else { |
1623 | 1623 | // Set comment for the cell |
1624 | 1624 | $this->phpSheet->getComment($cellAddress)->setText($this->parseRichText($noteText)); |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | $text = $this->getSplicedRecordData(); |
1657 | 1657 | |
1658 | 1658 | $this->textObjects[$this->textObjRef] = array( |
1659 | - 'text' => substr($text["recordData"], $text["spliceOffsets"][0]+1, $cchText), |
|
1659 | + 'text' => substr($text["recordData"], $text["spliceOffsets"][0] + 1, $cchText), |
|
1660 | 1660 | 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), |
1661 | 1661 | 'alignment' => $grbitOpts, |
1662 | 1662 | 'rotation' => $rot |
@@ -2871,7 +2871,7 @@ discard block |
||
2871 | 2871 | ++$pos; |
2872 | 2872 | |
2873 | 2873 | // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed |
2874 | - $isCompressed = (($optionFlags & 0x01) == 0) ; |
|
2874 | + $isCompressed = (($optionFlags & 0x01) == 0); |
|
2875 | 2875 | |
2876 | 2876 | // bit: 2; mask: 0x02; 0 = ordinary; 1 = Asian phonetic |
2877 | 2877 | $hasAsian = (($optionFlags & 0x04) != 0); |
@@ -3385,7 +3385,7 @@ discard block |
||
3385 | 3385 | |
3386 | 3386 | // bit 0, mask 0x01; 1 = sheet is protected |
3387 | 3387 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3388 | - $this->phpSheet->getProtection()->setSheet((bool)$bool); |
|
3388 | + $this->phpSheet->getProtection()->setSheet((bool) $bool); |
|
3389 | 3389 | } |
3390 | 3390 | |
3391 | 3391 | |
@@ -3409,7 +3409,7 @@ discard block |
||
3409 | 3409 | // bit: 0, mask 0x01; 1 = scenarios are protected |
3410 | 3410 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3411 | 3411 | |
3412 | - $this->phpSheet->getProtection()->setScenarios((bool)$bool); |
|
3412 | + $this->phpSheet->getProtection()->setScenarios((bool) $bool); |
|
3413 | 3413 | } |
3414 | 3414 | |
3415 | 3415 | |
@@ -3433,7 +3433,7 @@ discard block |
||
3433 | 3433 | // bit: 0, mask 0x01; 1 = objects are protected |
3434 | 3434 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
3435 | 3435 | |
3436 | - $this->phpSheet->getProtection()->setObjects((bool)$bool); |
|
3436 | + $this->phpSheet->getProtection()->setObjects((bool) $bool); |
|
3437 | 3437 | } |
3438 | 3438 | |
3439 | 3439 | |
@@ -3869,7 +3869,7 @@ discard block |
||
3869 | 3869 | // get the base cell, grab tExp token |
3870 | 3870 | $baseRow = self::getInt2d($formulaStructure, 3); |
3871 | 3871 | $baseCol = self::getInt2d($formulaStructure, 5); |
3872 | - $this->_baseCell = \PhpSpreadsheet\Cell::stringFromColumnIndex($baseCol). ($baseRow + 1); |
|
3872 | + $this->_baseCell = \PhpSpreadsheet\Cell::stringFromColumnIndex($baseCol) . ($baseRow + 1); |
|
3873 | 3873 | } |
3874 | 3874 | |
3875 | 3875 | // Read cell? |
@@ -4298,7 +4298,7 @@ discard block |
||
4298 | 4298 | $this->frozen = (bool) ((0x0008 & $options) >> 3); |
4299 | 4299 | |
4300 | 4300 | // bit: 6; mask: 0x0040; 0 = columns from left to right, 1 = columns from right to left |
4301 | - $this->phpSheet->setRightToLeft((bool)((0x0040 & $options) >> 6)); |
|
4301 | + $this->phpSheet->setRightToLeft((bool) ((0x0040 & $options) >> 6)); |
|
4302 | 4302 | |
4303 | 4303 | // bit: 10; mask: 0x0400; 0 = sheet not active, 1 = sheet active |
4304 | 4304 | $isActive = (bool) ((0x0400 & $options) >> 10); |
@@ -4873,9 +4873,9 @@ discard block |
||
4873 | 4873 | $objValidation = $this->phpSheet->getCell($coordinate)->getDataValidation(); |
4874 | 4874 | $objValidation->setType($type); |
4875 | 4875 | $objValidation->setErrorStyle($errorStyle); |
4876 | - $objValidation->setAllowBlank((bool)$allowBlank); |
|
4877 | - $objValidation->setShowInputMessage((bool)$showInputMessage); |
|
4878 | - $objValidation->setShowErrorMessage((bool)$showErrorMessage); |
|
4876 | + $objValidation->setAllowBlank((bool) $allowBlank); |
|
4877 | + $objValidation->setShowInputMessage((bool) $showInputMessage); |
|
4878 | + $objValidation->setShowErrorMessage((bool) $showErrorMessage); |
|
4879 | 4879 | $objValidation->setShowDropDown(!$suppressDropDown); |
4880 | 4880 | $objValidation->setOperator($operator); |
4881 | 4881 | $objValidation->setErrorTitle($errorTitle); |
@@ -5700,7 +5700,7 @@ discard block |
||
5700 | 5700 | $name = 'tNum'; |
5701 | 5701 | $size = 9; |
5702 | 5702 | $data = self::extractNumber(substr($formulaData, 1)); |
5703 | - $data = str_replace(',', '.', (string)$data); // in case non-English locale |
|
5703 | + $data = str_replace(',', '.', (string) $data); // in case non-English locale |
|
5704 | 5704 | break; |
5705 | 5705 | case 0x20: // array constant |
5706 | 5706 | case 0x40: |
@@ -7470,7 +7470,7 @@ discard block |
||
7470 | 7470 | $sign = ($rknum & 0x80000000) >> 31; |
7471 | 7471 | $exp = ($rknum & 0x7ff00000) >> 20; |
7472 | 7472 | $mantissa = (0x100000 | ($rknum & 0x000ffffc)); |
7473 | - $value = $mantissa / pow(2, (20- ($exp - 1023))); |
|
7473 | + $value = $mantissa / pow(2, (20 - ($exp - 1023))); |
|
7474 | 7474 | if ($sign) { |
7475 | 7475 | $value = -1 * $value; |
7476 | 7476 | } |
@@ -7539,7 +7539,7 @@ discard block |
||
7539 | 7539 | */ |
7540 | 7540 | public static function getInt2d($data, $pos) |
7541 | 7541 | { |
7542 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); |
|
7542 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); |
|
7543 | 7543 | } |
7544 | 7544 | |
7545 | 7545 | |
@@ -7562,7 +7562,7 @@ discard block |
||
7562 | 7562 | } else { |
7563 | 7563 | $_ord_24 = ($_or_24 & 127) << 24; |
7564 | 7564 | } |
7565 | - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24; |
|
7565 | + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24; |
|
7566 | 7566 | } |
7567 | 7567 | |
7568 | 7568 |
@@ -9,6 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @param int $color Indexed color |
11 | 11 | * @param array $palette Color palette |
12 | + * @param integer $version |
|
12 | 13 | * @return array RGB color value, example: array('rgb' => 'FF0000') |
13 | 14 | */ |
14 | 15 | public static function map($color, $palette, $version) |
@@ -190,6 +190,11 @@ |
||
190 | 190 | return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z) |
191 | 191 | } |
192 | 192 | |
193 | + /** |
|
194 | + * @param string[] $func |
|
195 | + * @param integer $s |
|
196 | + * @param integer $t |
|
197 | + */ |
|
193 | 198 | private static function step($func, &$A, $B, $C, $D, $M, $s, $t) |
194 | 199 | { |
195 | 200 | $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff; |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $C = $this->c; |
88 | 88 | $D = $this->d; |
89 | 89 | |
90 | - $F = ['self','f']; |
|
91 | - $G = ['self','g']; |
|
92 | - $H = ['self','h']; |
|
93 | - $I = ['self','i']; |
|
90 | + $F = ['self', 'f']; |
|
91 | + $G = ['self', 'g']; |
|
92 | + $H = ['self', 'h']; |
|
93 | + $I = ['self', 'i']; |
|
94 | 94 | |
95 | 95 | /* ROUND 1 */ |
96 | 96 | self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | private static function i($X, $Y, $Z) |
189 | 189 | { |
190 | - return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z) |
|
190 | + return ($Y ^ ($X | (~ $Z))); // Y XOR (X OR NOT Z) |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | private static function step($func, &$A, $B, $C, $D, $M, $s, $t) |
@@ -200,6 +200,6 @@ discard block |
||
200 | 200 | private static function rotate($decimal, $bits) |
201 | 201 | { |
202 | 202 | $binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT); |
203 | - return bindec(substr($binary, $bits).substr($binary, 0, $bits)); |
|
203 | + return bindec(substr($binary, $bits) . substr($binary, 0, $bits)); |
|
204 | 204 | } |
205 | 205 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Convert pixels to EMU |
34 | 34 | * |
35 | 35 | * @param int $pValue Value in pixels |
36 | - * @return int Value in EMU |
|
36 | + * @return double Value in EMU |
|
37 | 37 | */ |
38 | 38 | public static function pixelsToEMU($pValue = 0) |
39 | 39 | { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * Convert pixels to points |
115 | 115 | * |
116 | 116 | * @param int $pValue Value in pixels |
117 | - * @return int Value in points |
|
117 | + * @return double Value in points |
|
118 | 118 | */ |
119 | 119 | public static function pixelsToPoints($pValue = 0) |
120 | 120 | { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * Create a new image from file. By alexander at alexauto dot nl |
167 | 167 | * |
168 | 168 | * @link http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 |
169 | - * @param string $filename Path to Windows DIB (BMP) image |
|
169 | + * @param string $p_sFile |
|
170 | 170 | * @return resource |
171 | 171 | */ |
172 | 172 | public static function imagecreatefrombmp($p_sFile) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public static function degreesToAngle($pValue = 0) |
146 | 146 | { |
147 | - return (int)round($pValue * 60000); |
|
147 | + return (int) round($pValue * 60000); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // Load the image into a string |
175 | 175 | $file = fopen($p_sFile, "rb"); |
176 | 176 | $read = fread($file, 10); |
177 | - while (!feof($file) && ($read<>"")) { |
|
177 | + while (!feof($file) && ($read <> "")) { |
|
178 | 178 | $read .= fread($file, 1024); |
179 | 179 | } |
180 | 180 | |
@@ -184,15 +184,15 @@ discard block |
||
184 | 184 | |
185 | 185 | // Process the header |
186 | 186 | // Structure: http://www.fastgraph.com/help/bmp_header_format.html |
187 | - if (substr($header, 0, 4)=="424d") { |
|
187 | + if (substr($header, 0, 4) == "424d") { |
|
188 | 188 | // Cut it in parts of 2 bytes |
189 | 189 | $header_parts = str_split($header, 2); |
190 | 190 | |
191 | 191 | // Get the width 4 bytes |
192 | - $width = hexdec($header_parts[19].$header_parts[18]); |
|
192 | + $width = hexdec($header_parts[19] . $header_parts[18]); |
|
193 | 193 | |
194 | 194 | // Get the height 4 bytes |
195 | - $height = hexdec($header_parts[23].$header_parts[22]); |
|
195 | + $height = hexdec($header_parts[23] . $header_parts[22]); |
|
196 | 196 | |
197 | 197 | // Unset the header params |
198 | 198 | unset($header_parts); |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | // Calculate if padding at the end-line is needed |
212 | 212 | // Divided by two to keep overview. |
213 | 213 | // 1 byte = 2 HEX-chars |
214 | - $body_size = (strlen($body)/2); |
|
215 | - $header_size = ($width*$height); |
|
214 | + $body_size = (strlen($body) / 2); |
|
215 | + $header_size = ($width * $height); |
|
216 | 216 | |
217 | 217 | // Use end-line padding? Only when needed |
218 | - $usePadding = ($body_size>($header_size*3)+4); |
|
218 | + $usePadding = ($body_size > ($header_size * 3) + 4); |
|
219 | 219 | |
220 | 220 | // Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption |
221 | 221 | // Calculate the next DWORD-position in the body |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // If padding needed, ignore image-padding |
226 | 226 | // Shift i to the ending of the current 32-bit-block |
227 | 227 | if ($usePadding) { |
228 | - $i += $width%4; |
|
228 | + $i += $width % 4; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Reset horizontal position |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
244 | 244 | // Define $i_pos as absolute position in the body |
245 | 245 | $i_pos = $i * 2; |
246 | - $r = hexdec($body[$i_pos+4].$body[$i_pos+5]); |
|
247 | - $g = hexdec($body[$i_pos+2].$body[$i_pos+3]); |
|
248 | - $b = hexdec($body[$i_pos].$body[$i_pos+1]); |
|
246 | + $r = hexdec($body[$i_pos + 4] . $body[$i_pos + 5]); |
|
247 | + $g = hexdec($body[$i_pos + 2] . $body[$i_pos + 3]); |
|
248 | + $b = hexdec($body[$i_pos] . $body[$i_pos + 1]); |
|
249 | 249 | |
250 | 250 | // Calculate and draw the pixel |
251 | 251 | $color = imagecolorallocate($image, $r, $g, $b); |
252 | - imagesetpixel($image, $x, $height-$y, $color); |
|
252 | + imagesetpixel($image, $x, $height - $y, $color); |
|
253 | 253 | |
254 | 254 | // Raise the horizontal position |
255 | 255 | $x++; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Get the shape index |
208 | 208 | * |
209 | - * @return int |
|
209 | + * @return boolean |
|
210 | 210 | */ |
211 | 211 | public function getSpId() |
212 | 212 | { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * Set an option for the Shape Group Container |
218 | 218 | * |
219 | 219 | * @param int $property The number specifies the option |
220 | - * @param mixed $value |
|
220 | + * @param integer $value |
|
221 | 221 | */ |
222 | 222 | public function setOPT($property, $value) |
223 | 223 | { |
@@ -331,7 +331,6 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width |
333 | 333 | * |
334 | - * @param int $startOffsetX |
|
335 | 334 | */ |
336 | 335 | public function setEndOffsetX($endOffsetX = 0) |
337 | 336 | { |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * Return the eigenvector matrix |
817 | 817 | * |
818 | 818 | * @access public |
819 | - * @return V |
|
819 | + * @return Matrix |
|
820 | 820 | */ |
821 | 821 | public function getV() |
822 | 822 | { |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * Return the block diagonal eigenvalue matrix |
850 | 850 | * |
851 | 851 | * @access public |
852 | - * @return D |
|
852 | + * @return Matrix |
|
853 | 853 | */ |
854 | 854 | public function getD() |
855 | 855 | { |
@@ -52,21 +52,21 @@ |
||
52 | 52 | private $V = array(); |
53 | 53 | |
54 | 54 | /** |
55 | - * Array for internal storage of nonsymmetric Hessenberg form. |
|
56 | - * @var array |
|
57 | - */ |
|
55 | + * Array for internal storage of nonsymmetric Hessenberg form. |
|
56 | + * @var array |
|
57 | + */ |
|
58 | 58 | private $H = array(); |
59 | 59 | |
60 | 60 | /** |
61 | - * Working storage for nonsymmetric algorithm. |
|
62 | - * @var array |
|
63 | - */ |
|
61 | + * Working storage for nonsymmetric algorithm. |
|
62 | + * @var array |
|
63 | + */ |
|
64 | 64 | private $ort; |
65 | 65 | |
66 | 66 | /** |
67 | - * Used for complex scalar division. |
|
68 | - * @var float |
|
69 | - */ |
|
67 | + * Used for complex scalar division. |
|
68 | + * @var float |
|
69 | + */ |
|
70 | 70 | private $cdivr; |
71 | 71 | private $cdivi; |
72 | 72 |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | // Bowdler, Martin, Reinsch, and Wilkinson, Handbook for |
82 | 82 | // Auto. Comp., Vol.ii-Linear Algebra, and the corresponding |
83 | 83 | // Fortran subroutine in EISPACK. |
84 | - $this->d = $this->V[$this->n-1]; |
|
84 | + $this->d = $this->V[$this->n - 1]; |
|
85 | 85 | // Householder reduction to tridiagonal form. |
86 | - for ($i = $this->n-1; $i > 0; --$i) { |
|
87 | - $i_ = $i -1; |
|
86 | + for ($i = $this->n - 1; $i > 0; --$i) { |
|
87 | + $i_ = $i - 1; |
|
88 | 88 | // Scale to avoid under/overflow. |
89 | 89 | $h = $scale = 0.0; |
90 | 90 | $scale += array_sum(array_map(abs, $this->d)); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $f = $this->d[$j]; |
117 | 117 | $this->V[$j][$i] = $f; |
118 | 118 | $g = $this->e[$j] + $this->V[$j][$j] * $f; |
119 | - for ($k = $j+1; $k <= $i_; ++$k) { |
|
119 | + for ($k = $j + 1; $k <= $i_; ++$k) { |
|
120 | 120 | $g += $this->V[$k][$j] * $this->d[$k]; |
121 | 121 | $this->e[$k] += $this->V[$k][$j] * $f; |
122 | 122 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $f += $this->e[$j] * $this->d[$j]; |
129 | 129 | } |
130 | 130 | $hh = $f / (2 * $h); |
131 | - for ($j=0; $j < $i; ++$j) { |
|
131 | + for ($j = 0; $j < $i; ++$j) { |
|
132 | 132 | $this->e[$j] -= $hh * $this->d[$j]; |
133 | 133 | } |
134 | 134 | for ($j = 0; $j < $i; ++$j) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | for ($k = $j; $k <= $i_; ++$k) { |
138 | 138 | $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]); |
139 | 139 | } |
140 | - $this->d[$j] = $this->V[$i-1][$j]; |
|
140 | + $this->d[$j] = $this->V[$i - 1][$j]; |
|
141 | 141 | $this->V[$i][$j] = 0.0; |
142 | 142 | } |
143 | 143 | } |
@@ -145,18 +145,18 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | // Accumulate transformations. |
148 | - for ($i = 0; $i < $this->n-1; ++$i) { |
|
149 | - $this->V[$this->n-1][$i] = $this->V[$i][$i]; |
|
148 | + for ($i = 0; $i < $this->n - 1; ++$i) { |
|
149 | + $this->V[$this->n - 1][$i] = $this->V[$i][$i]; |
|
150 | 150 | $this->V[$i][$i] = 1.0; |
151 | - $h = $this->d[$i+1]; |
|
151 | + $h = $this->d[$i + 1]; |
|
152 | 152 | if ($h != 0.0) { |
153 | 153 | for ($k = 0; $k <= $i; ++$k) { |
154 | - $this->d[$k] = $this->V[$k][$i+1] / $h; |
|
154 | + $this->d[$k] = $this->V[$k][$i + 1] / $h; |
|
155 | 155 | } |
156 | 156 | for ($j = 0; $j <= $i; ++$j) { |
157 | 157 | $g = 0.0; |
158 | 158 | for ($k = 0; $k <= $i; ++$k) { |
159 | - $g += $this->V[$k][$i+1] * $this->V[$k][$j]; |
|
159 | + $g += $this->V[$k][$i + 1] * $this->V[$k][$j]; |
|
160 | 160 | } |
161 | 161 | for ($k = 0; $k <= $i; ++$k) { |
162 | 162 | $this->V[$k][$j] -= $g * $this->d[$k]; |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | for ($k = 0; $k <= $i; ++$k) { |
167 | - $this->V[$k][$i+1] = 0.0; |
|
167 | + $this->V[$k][$i + 1] = 0.0; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - $this->d = $this->V[$this->n-1]; |
|
172 | - $this->V[$this->n-1] = array_fill(0, $j, 0.0); |
|
173 | - $this->V[$this->n-1][$this->n-1] = 1.0; |
|
171 | + $this->d = $this->V[$this->n - 1]; |
|
172 | + $this->V[$this->n - 1] = array_fill(0, $j, 0.0); |
|
173 | + $this->V[$this->n - 1][$this->n - 1] = 1.0; |
|
174 | 174 | $this->e[0] = 0.0; |
175 | 175 | } |
176 | 176 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | private function tql2() |
188 | 188 | { |
189 | 189 | for ($i = 1; $i < $this->n; ++$i) { |
190 | - $this->e[$i-1] = $this->e[$i]; |
|
190 | + $this->e[$i - 1] = $this->e[$i]; |
|
191 | 191 | } |
192 | - $this->e[$this->n-1] = 0.0; |
|
192 | + $this->e[$this->n - 1] = 0.0; |
|
193 | 193 | $f = 0.0; |
194 | 194 | $tst1 = 0.0; |
195 | 195 | $eps = pow(2.0, -52.0); |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | $iter += 1; |
214 | 214 | // Compute implicit shift |
215 | 215 | $g = $this->d[$l]; |
216 | - $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]); |
|
216 | + $p = ($this->d[$l + 1] - $g) / (2.0 * $this->e[$l]); |
|
217 | 217 | $r = hypo($p, 1.0); |
218 | 218 | if ($p < 0) { |
219 | 219 | $r *= -1; |
220 | 220 | } |
221 | 221 | $this->d[$l] = $this->e[$l] / ($p + $r); |
222 | - $this->d[$l+1] = $this->e[$l] * ($p + $r); |
|
223 | - $dl1 = $this->d[$l+1]; |
|
222 | + $this->d[$l + 1] = $this->e[$l] * ($p + $r); |
|
223 | + $dl1 = $this->d[$l + 1]; |
|
224 | 224 | $h = $g - $this->d[$l]; |
225 | 225 | for ($i = $l + 2; $i < $this->n; ++$i) { |
226 | 226 | $this->d[$i] -= $h; |
@@ -232,22 +232,22 @@ discard block |
||
232 | 232 | $c2 = $c3 = $c; |
233 | 233 | $el1 = $this->e[$l + 1]; |
234 | 234 | $s = $s2 = 0.0; |
235 | - for ($i = $m-1; $i >= $l; --$i) { |
|
235 | + for ($i = $m - 1; $i >= $l; --$i) { |
|
236 | 236 | $c3 = $c2; |
237 | 237 | $c2 = $c; |
238 | 238 | $s2 = $s; |
239 | 239 | $g = $c * $this->e[$i]; |
240 | 240 | $h = $c * $p; |
241 | 241 | $r = hypo($p, $this->e[$i]); |
242 | - $this->e[$i+1] = $s * $r; |
|
242 | + $this->e[$i + 1] = $s * $r; |
|
243 | 243 | $s = $this->e[$i] / $r; |
244 | 244 | $c = $p / $r; |
245 | 245 | $p = $c * $this->d[$i] - $s * $g; |
246 | - $this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]); |
|
246 | + $this->d[$i + 1] = $h + $s * ($c * $g + $s * $this->d[$i]); |
|
247 | 247 | // Accumulate transformation. |
248 | 248 | for ($k = 0; $k < $this->n; ++$k) { |
249 | - $h = $this->V[$k][$i+1]; |
|
250 | - $this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h; |
|
249 | + $h = $this->V[$k][$i + 1]; |
|
250 | + $this->V[$k][$i + 1] = $s * $this->V[$k][$i] + $c * $h; |
|
251 | 251 | $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h; |
252 | 252 | } |
253 | 253 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | for ($i = 0; $i < $this->n - 1; ++$i) { |
266 | 266 | $k = $i; |
267 | 267 | $p = $this->d[$i]; |
268 | - for ($j = $i+1; $j < $this->n; ++$j) { |
|
268 | + for ($j = $i + 1; $j < $this->n; ++$j) { |
|
269 | 269 | if ($this->d[$j] < $p) { |
270 | 270 | $k = $j; |
271 | 271 | $p = $this->d[$j]; |
@@ -296,19 +296,19 @@ discard block |
||
296 | 296 | private function orthes() |
297 | 297 | { |
298 | 298 | $low = 0; |
299 | - $high = $this->n-1; |
|
299 | + $high = $this->n - 1; |
|
300 | 300 | |
301 | - for ($m = $low+1; $m <= $high-1; ++$m) { |
|
301 | + for ($m = $low + 1; $m <= $high - 1; ++$m) { |
|
302 | 302 | // Scale column. |
303 | 303 | $scale = 0.0; |
304 | 304 | for ($i = $m; $i <= $high; ++$i) { |
305 | - $scale = $scale + abs($this->H[$i][$m-1]); |
|
305 | + $scale = $scale + abs($this->H[$i][$m - 1]); |
|
306 | 306 | } |
307 | 307 | if ($scale != 0.0) { |
308 | 308 | // Compute Householder transformation. |
309 | 309 | $h = 0.0; |
310 | 310 | for ($i = $high; $i >= $m; --$i) { |
311 | - $this->ort[$i] = $this->H[$i][$m-1] / $scale; |
|
311 | + $this->ort[$i] = $this->H[$i][$m - 1] / $scale; |
|
312 | 312 | $h += $this->ort[$i] * $this->ort[$i]; |
313 | 313 | } |
314 | 314 | $g = sqrt($h); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | } |
342 | 342 | $this->ort[$m] = $scale * $this->ort[$m]; |
343 | - $this->H[$m][$m-1] = $scale * $g; |
|
343 | + $this->H[$m][$m - 1] = $scale * $g; |
|
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0); |
351 | 351 | } |
352 | 352 | } |
353 | - for ($m = $high-1; $m >= $low+1; --$m) { |
|
354 | - if ($this->H[$m][$m-1] != 0.0) { |
|
355 | - for ($i = $m+1; $i <= $high; ++$i) { |
|
356 | - $this->ort[$i] = $this->H[$i][$m-1]; |
|
353 | + for ($m = $high - 1; $m >= $low + 1; --$m) { |
|
354 | + if ($this->H[$m][$m - 1] != 0.0) { |
|
355 | + for ($i = $m + 1; $i <= $high; ++$i) { |
|
356 | + $this->ort[$i] = $this->H[$i][$m - 1]; |
|
357 | 357 | } |
358 | 358 | for ($j = $m; $j <= $high; ++$j) { |
359 | 359 | $g = 0.0; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $g += $this->ort[$i] * $this->V[$i][$j]; |
362 | 362 | } |
363 | 363 | // Double division avoids possible underflow |
364 | - $g = ($g / $this->ort[$m]) / $this->H[$m][$m-1]; |
|
364 | + $g = ($g / $this->ort[$m]) / $this->H[$m][$m - 1]; |
|
365 | 365 | for ($i = $m; $i <= $high; ++$i) { |
366 | 366 | $this->V[$i][$j] += $g * $this->ort[$i]; |
367 | 367 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $this->d[$i] = $this->H[$i][$i]; |
419 | 419 | $this->e[$i] = 0.0; |
420 | 420 | } |
421 | - for ($j = max($i-1, 0); $j < $nn; ++$j) { |
|
421 | + for ($j = max($i - 1, 0); $j < $nn; ++$j) { |
|
422 | 422 | $norm = $norm + abs($this->H[$i][$j]); |
423 | 423 | } |
424 | 424 | } |
@@ -429,11 +429,11 @@ discard block |
||
429 | 429 | // Look for single small sub-diagonal element |
430 | 430 | $l = $n; |
431 | 431 | while ($l > $low) { |
432 | - $s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]); |
|
432 | + $s = abs($this->H[$l - 1][$l - 1]) + abs($this->H[$l][$l]); |
|
433 | 433 | if ($s == 0.0) { |
434 | 434 | $s = $norm; |
435 | 435 | } |
436 | - if (abs($this->H[$l][$l-1]) < $eps * $s) { |
|
436 | + if (abs($this->H[$l][$l - 1]) < $eps * $s) { |
|
437 | 437 | break; |
438 | 438 | } |
439 | 439 | --$l; |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | --$n; |
448 | 448 | $iter = 0; |
449 | 449 | // Two roots found |
450 | - } elseif ($l == $n-1) { |
|
451 | - $w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; |
|
452 | - $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0; |
|
450 | + } elseif ($l == $n - 1) { |
|
451 | + $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n]; |
|
452 | + $p = ($this->H[$n - 1][$n - 1] - $this->H[$n][$n]) / 2.0; |
|
453 | 453 | $q = $p * $p + $w; |
454 | 454 | $z = sqrt(abs($q)); |
455 | 455 | $this->H[$n][$n] = $this->H[$n][$n] + $exshift; |
456 | - $this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift; |
|
456 | + $this->H[$n - 1][$n - 1] = $this->H[$n - 1][$n - 1] + $exshift; |
|
457 | 457 | $x = $this->H[$n][$n]; |
458 | 458 | // Real pair |
459 | 459 | if ($q >= 0) { |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | } else { |
463 | 463 | $z = $p - $z; |
464 | 464 | } |
465 | - $this->d[$n-1] = $x + $z; |
|
466 | - $this->d[$n] = $this->d[$n-1]; |
|
465 | + $this->d[$n - 1] = $x + $z; |
|
466 | + $this->d[$n] = $this->d[$n - 1]; |
|
467 | 467 | if ($z != 0.0) { |
468 | 468 | $this->d[$n] = $x - $w / $z; |
469 | 469 | } |
470 | - $this->e[$n-1] = 0.0; |
|
470 | + $this->e[$n - 1] = 0.0; |
|
471 | 471 | $this->e[$n] = 0.0; |
472 | - $x = $this->H[$n][$n-1]; |
|
472 | + $x = $this->H[$n][$n - 1]; |
|
473 | 473 | $s = abs($x) + abs($z); |
474 | 474 | $p = $x / $s; |
475 | 475 | $q = $z / $s; |
@@ -477,28 +477,28 @@ discard block |
||
477 | 477 | $p = $p / $r; |
478 | 478 | $q = $q / $r; |
479 | 479 | // Row modification |
480 | - for ($j = $n-1; $j < $nn; ++$j) { |
|
481 | - $z = $this->H[$n-1][$j]; |
|
482 | - $this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j]; |
|
480 | + for ($j = $n - 1; $j < $nn; ++$j) { |
|
481 | + $z = $this->H[$n - 1][$j]; |
|
482 | + $this->H[$n - 1][$j] = $q * $z + $p * $this->H[$n][$j]; |
|
483 | 483 | $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z; |
484 | 484 | } |
485 | 485 | // Column modification |
486 | 486 | for ($i = 0; $i <= $n; ++$i) { |
487 | - $z = $this->H[$i][$n-1]; |
|
488 | - $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n]; |
|
487 | + $z = $this->H[$i][$n - 1]; |
|
488 | + $this->H[$i][$n - 1] = $q * $z + $p * $this->H[$i][$n]; |
|
489 | 489 | $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z; |
490 | 490 | } |
491 | 491 | // Accumulate transformations |
492 | 492 | for ($i = $low; $i <= $high; ++$i) { |
493 | - $z = $this->V[$i][$n-1]; |
|
494 | - $this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n]; |
|
493 | + $z = $this->V[$i][$n - 1]; |
|
494 | + $this->V[$i][$n - 1] = $q * $z + $p * $this->V[$i][$n]; |
|
495 | 495 | $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z; |
496 | 496 | } |
497 | 497 | // Complex pair |
498 | 498 | } else { |
499 | - $this->d[$n-1] = $x + $p; |
|
499 | + $this->d[$n - 1] = $x + $p; |
|
500 | 500 | $this->d[$n] = $x + $p; |
501 | - $this->e[$n-1] = $z; |
|
501 | + $this->e[$n - 1] = $z; |
|
502 | 502 | $this->e[$n] = -$z; |
503 | 503 | } |
504 | 504 | $n = $n - 2; |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | $y = 0.0; |
511 | 511 | $w = 0.0; |
512 | 512 | if ($l < $n) { |
513 | - $y = $this->H[$n-1][$n-1]; |
|
514 | - $w = $this->H[$n][$n-1] * $this->H[$n-1][$n]; |
|
513 | + $y = $this->H[$n - 1][$n - 1]; |
|
514 | + $w = $this->H[$n][$n - 1] * $this->H[$n - 1][$n]; |
|
515 | 515 | } |
516 | 516 | // Wilkinson's original ad hoc shift |
517 | 517 | if ($iter == 10) { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | for ($i = $low; $i <= $n; ++$i) { |
520 | 520 | $this->H[$i][$i] -= $x; |
521 | 521 | } |
522 | - $s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]); |
|
522 | + $s = abs($this->H[$n][$n - 1]) + abs($this->H[$n - 1][$n - 2]); |
|
523 | 523 | $x = $y = 0.75 * $s; |
524 | 524 | $w = -0.4375 * $s * $s; |
525 | 525 | } |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | $z = $this->H[$m][$m]; |
549 | 549 | $r = $x - $z; |
550 | 550 | $s = $y - $z; |
551 | - $p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1]; |
|
552 | - $q = $this->H[$m+1][$m+1] - $z - $r - $s; |
|
553 | - $r = $this->H[$m+2][$m+1]; |
|
551 | + $p = ($r * $s - $w) / $this->H[$m + 1][$m] + $this->H[$m][$m + 1]; |
|
552 | + $q = $this->H[$m + 1][$m + 1] - $z - $r - $s; |
|
553 | + $r = $this->H[$m + 2][$m + 1]; |
|
554 | 554 | $s = abs($p) + abs($q) + abs($r); |
555 | 555 | $p = $p / $s; |
556 | 556 | $q = $q / $s; |
@@ -558,25 +558,25 @@ discard block |
||
558 | 558 | if ($m == $l) { |
559 | 559 | break; |
560 | 560 | } |
561 | - if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) < |
|
562 | - $eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) { |
|
561 | + if (abs($this->H[$m][$m - 1]) * (abs($q) + abs($r)) < |
|
562 | + $eps * (abs($p) * (abs($this->H[$m - 1][$m - 1]) + abs($z) + abs($this->H[$m + 1][$m + 1])))) { |
|
563 | 563 | break; |
564 | 564 | } |
565 | 565 | --$m; |
566 | 566 | } |
567 | 567 | for ($i = $m + 2; $i <= $n; ++$i) { |
568 | - $this->H[$i][$i-2] = 0.0; |
|
569 | - if ($i > $m+2) { |
|
570 | - $this->H[$i][$i-3] = 0.0; |
|
568 | + $this->H[$i][$i - 2] = 0.0; |
|
569 | + if ($i > $m + 2) { |
|
570 | + $this->H[$i][$i - 3] = 0.0; |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | // Double QR step involving rows l:n and columns m:n |
574 | - for ($k = $m; $k <= $n-1; ++$k) { |
|
575 | - $notlast = ($k != $n-1); |
|
574 | + for ($k = $m; $k <= $n - 1; ++$k) { |
|
575 | + $notlast = ($k != $n - 1); |
|
576 | 576 | if ($k != $m) { |
577 | - $p = $this->H[$k][$k-1]; |
|
578 | - $q = $this->H[$k+1][$k-1]; |
|
579 | - $r = ($notlast ? $this->H[$k+2][$k-1] : 0.0); |
|
577 | + $p = $this->H[$k][$k - 1]; |
|
578 | + $q = $this->H[$k + 1][$k - 1]; |
|
579 | + $r = ($notlast ? $this->H[$k + 2][$k - 1] : 0.0); |
|
580 | 580 | $x = abs($p) + abs($q) + abs($r); |
581 | 581 | if ($x != 0.0) { |
582 | 582 | $p = $p / $x; |
@@ -593,9 +593,9 @@ discard block |
||
593 | 593 | } |
594 | 594 | if ($s != 0) { |
595 | 595 | if ($k != $m) { |
596 | - $this->H[$k][$k-1] = -$s * $x; |
|
596 | + $this->H[$k][$k - 1] = -$s * $x; |
|
597 | 597 | } elseif ($l != $m) { |
598 | - $this->H[$k][$k-1] = -$this->H[$k][$k-1]; |
|
598 | + $this->H[$k][$k - 1] = -$this->H[$k][$k - 1]; |
|
599 | 599 | } |
600 | 600 | $p = $p + $s; |
601 | 601 | $x = $p / $s; |
@@ -605,33 +605,33 @@ discard block |
||
605 | 605 | $r = $r / $p; |
606 | 606 | // Row modification |
607 | 607 | for ($j = $k; $j < $nn; ++$j) { |
608 | - $p = $this->H[$k][$j] + $q * $this->H[$k+1][$j]; |
|
608 | + $p = $this->H[$k][$j] + $q * $this->H[$k + 1][$j]; |
|
609 | 609 | if ($notlast) { |
610 | - $p = $p + $r * $this->H[$k+2][$j]; |
|
611 | - $this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z; |
|
610 | + $p = $p + $r * $this->H[$k + 2][$j]; |
|
611 | + $this->H[$k + 2][$j] = $this->H[$k + 2][$j] - $p * $z; |
|
612 | 612 | } |
613 | 613 | $this->H[$k][$j] = $this->H[$k][$j] - $p * $x; |
614 | - $this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y; |
|
614 | + $this->H[$k + 1][$j] = $this->H[$k + 1][$j] - $p * $y; |
|
615 | 615 | } |
616 | 616 | // Column modification |
617 | - for ($i = 0; $i <= min($n, $k+3); ++$i) { |
|
618 | - $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1]; |
|
617 | + for ($i = 0; $i <= min($n, $k + 3); ++$i) { |
|
618 | + $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k + 1]; |
|
619 | 619 | if ($notlast) { |
620 | - $p = $p + $z * $this->H[$i][$k+2]; |
|
621 | - $this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r; |
|
620 | + $p = $p + $z * $this->H[$i][$k + 2]; |
|
621 | + $this->H[$i][$k + 2] = $this->H[$i][$k + 2] - $p * $r; |
|
622 | 622 | } |
623 | 623 | $this->H[$i][$k] = $this->H[$i][$k] - $p; |
624 | - $this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q; |
|
624 | + $this->H[$i][$k + 1] = $this->H[$i][$k + 1] - $p * $q; |
|
625 | 625 | } |
626 | 626 | // Accumulate transformations |
627 | 627 | for ($i = $low; $i <= $high; ++$i) { |
628 | - $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1]; |
|
628 | + $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k + 1]; |
|
629 | 629 | if ($notlast) { |
630 | - $p = $p + $z * $this->V[$i][$k+2]; |
|
631 | - $this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r; |
|
630 | + $p = $p + $z * $this->V[$i][$k + 2]; |
|
631 | + $this->V[$i][$k + 2] = $this->V[$i][$k + 2] - $p * $r; |
|
632 | 632 | } |
633 | 633 | $this->V[$i][$k] = $this->V[$i][$k] - $p; |
634 | - $this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q; |
|
634 | + $this->V[$i][$k + 1] = $this->V[$i][$k + 1] - $p * $q; |
|
635 | 635 | } |
636 | 636 | } // ($s != 0) |
637 | 637 | } // k loop |
@@ -643,14 +643,14 @@ discard block |
||
643 | 643 | return; |
644 | 644 | } |
645 | 645 | |
646 | - for ($n = $nn-1; $n >= 0; --$n) { |
|
646 | + for ($n = $nn - 1; $n >= 0; --$n) { |
|
647 | 647 | $p = $this->d[$n]; |
648 | 648 | $q = $this->e[$n]; |
649 | 649 | // Real vector |
650 | 650 | if ($q == 0) { |
651 | 651 | $l = $n; |
652 | 652 | $this->H[$n][$n] = 1.0; |
653 | - for ($i = $n-1; $i >= 0; --$i) { |
|
653 | + for ($i = $n - 1; $i >= 0; --$i) { |
|
654 | 654 | $w = $this->H[$i][$i] - $p; |
655 | 655 | $r = 0.0; |
656 | 656 | for ($j = $l; $j <= $n; ++$j) { |
@@ -669,15 +669,15 @@ discard block |
||
669 | 669 | } |
670 | 670 | // Solve real equations |
671 | 671 | } else { |
672 | - $x = $this->H[$i][$i+1]; |
|
673 | - $y = $this->H[$i+1][$i]; |
|
672 | + $x = $this->H[$i][$i + 1]; |
|
673 | + $y = $this->H[$i + 1][$i]; |
|
674 | 674 | $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i]; |
675 | 675 | $t = ($x * $s - $z * $r) / $q; |
676 | 676 | $this->H[$i][$n] = $t; |
677 | 677 | if (abs($x) > abs($z)) { |
678 | - $this->H[$i+1][$n] = (-$r - $w * $t) / $x; |
|
678 | + $this->H[$i + 1][$n] = (-$r - $w * $t) / $x; |
|
679 | 679 | } else { |
680 | - $this->H[$i+1][$n] = (-$s - $y * $t) / $z; |
|
680 | + $this->H[$i + 1][$n] = (-$s - $y * $t) / $z; |
|
681 | 681 | } |
682 | 682 | } |
683 | 683 | // Overflow control |
@@ -691,24 +691,24 @@ discard block |
||
691 | 691 | } |
692 | 692 | // Complex vector |
693 | 693 | } elseif ($q < 0) { |
694 | - $l = $n-1; |
|
694 | + $l = $n - 1; |
|
695 | 695 | // Last vector component imaginary so matrix is triangular |
696 | - if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) { |
|
697 | - $this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1]; |
|
698 | - $this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1]; |
|
696 | + if (abs($this->H[$n][$n - 1]) > abs($this->H[$n - 1][$n])) { |
|
697 | + $this->H[$n - 1][$n - 1] = $q / $this->H[$n][$n - 1]; |
|
698 | + $this->H[$n - 1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n - 1]; |
|
699 | 699 | } else { |
700 | - $this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q); |
|
701 | - $this->H[$n-1][$n-1] = $this->cdivr; |
|
702 | - $this->H[$n-1][$n] = $this->cdivi; |
|
700 | + $this->cdiv(0.0, -$this->H[$n - 1][$n], $this->H[$n - 1][$n - 1] - $p, $q); |
|
701 | + $this->H[$n - 1][$n - 1] = $this->cdivr; |
|
702 | + $this->H[$n - 1][$n] = $this->cdivi; |
|
703 | 703 | } |
704 | - $this->H[$n][$n-1] = 0.0; |
|
704 | + $this->H[$n][$n - 1] = 0.0; |
|
705 | 705 | $this->H[$n][$n] = 1.0; |
706 | - for ($i = $n-2; $i >= 0; --$i) { |
|
706 | + for ($i = $n - 2; $i >= 0; --$i) { |
|
707 | 707 | // double ra,sa,vr,vi; |
708 | 708 | $ra = 0.0; |
709 | 709 | $sa = 0.0; |
710 | 710 | for ($j = $l; $j <= $n; ++$j) { |
711 | - $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1]; |
|
711 | + $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n - 1]; |
|
712 | 712 | $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n]; |
713 | 713 | } |
714 | 714 | $w = $this->H[$i][$i] - $p; |
@@ -720,34 +720,34 @@ discard block |
||
720 | 720 | $l = $i; |
721 | 721 | if ($this->e[$i] == 0) { |
722 | 722 | $this->cdiv(-$ra, -$sa, $w, $q); |
723 | - $this->H[$i][$n-1] = $this->cdivr; |
|
723 | + $this->H[$i][$n - 1] = $this->cdivr; |
|
724 | 724 | $this->H[$i][$n] = $this->cdivi; |
725 | 725 | } else { |
726 | 726 | // Solve complex equations |
727 | - $x = $this->H[$i][$i+1]; |
|
728 | - $y = $this->H[$i+1][$i]; |
|
727 | + $x = $this->H[$i][$i + 1]; |
|
728 | + $y = $this->H[$i + 1][$i]; |
|
729 | 729 | $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q; |
730 | 730 | $vi = ($this->d[$i] - $p) * 2.0 * $q; |
731 | 731 | if ($vr == 0.0 & $vi == 0.0) { |
732 | 732 | $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z)); |
733 | 733 | } |
734 | 734 | $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi); |
735 | - $this->H[$i][$n-1] = $this->cdivr; |
|
735 | + $this->H[$i][$n - 1] = $this->cdivr; |
|
736 | 736 | $this->H[$i][$n] = $this->cdivi; |
737 | 737 | if (abs($x) > (abs($z) + abs($q))) { |
738 | - $this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x; |
|
739 | - $this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x; |
|
738 | + $this->H[$i + 1][$n - 1] = (-$ra - $w * $this->H[$i][$n - 1] + $q * $this->H[$i][$n]) / $x; |
|
739 | + $this->H[$i + 1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n - 1]) / $x; |
|
740 | 740 | } else { |
741 | - $this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q); |
|
742 | - $this->H[$i+1][$n-1] = $this->cdivr; |
|
743 | - $this->H[$i+1][$n] = $this->cdivi; |
|
741 | + $this->cdiv(-$r - $y * $this->H[$i][$n - 1], -$s - $y * $this->H[$i][$n], $z, $q); |
|
742 | + $this->H[$i + 1][$n - 1] = $this->cdivr; |
|
743 | + $this->H[$i + 1][$n] = $this->cdivi; |
|
744 | 744 | } |
745 | 745 | } |
746 | 746 | // Overflow control |
747 | - $t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n])); |
|
747 | + $t = max(abs($this->H[$i][$n - 1]), abs($this->H[$i][$n])); |
|
748 | 748 | if (($eps * $t) * $t > 1) { |
749 | 749 | for ($j = $i; $j <= $n; ++$j) { |
750 | - $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t; |
|
750 | + $this->H[$j][$n - 1] = $this->H[$j][$n - 1] / $t; |
|
751 | 751 | $this->H[$j][$n] = $this->H[$j][$n] / $t; |
752 | 752 | } |
753 | 753 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | // Back transformation to get eigenvectors of original matrix |
769 | - for ($j = $nn-1; $j >= $low; --$j) { |
|
769 | + for ($j = $nn - 1; $j >= $low; --$j) { |
|
770 | 770 | for ($i = $low; $i <= $high; ++$i) { |
771 | 771 | $z = 0.0; |
772 | 772 | for ($k = $low; $k <= min($j, $high); ++$k) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * LU Decomposition constructor. |
61 | 61 | * |
62 | - * @param $A Rectangular matrix |
|
62 | + * @param Matrix $A Rectangular matrix |
|
63 | 63 | * @return Structure to access L, U and piv. |
64 | 64 | */ |
65 | 65 | public function __construct($A) |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * Get lower triangular factor. |
127 | 127 | * |
128 | - * @return array Lower triangular factor |
|
128 | + * @return Matrix Lower triangular factor |
|
129 | 129 | */ |
130 | 130 | public function getL() |
131 | 131 | { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * Get upper triangular factor. |
148 | 148 | * |
149 | - * @return array Upper triangular factor |
|
149 | + * @return Matrix Upper triangular factor |
|
150 | 150 | */ |
151 | 151 | public function getU() |
152 | 152 | { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | /** |
186 | 186 | * Is the matrix nonsingular? |
187 | 187 | * |
188 | - * @return true if U, and hence A, is nonsingular. |
|
188 | + * @return boolean if U, and hence A, is nonsingular. |
|
189 | 189 | */ |
190 | 190 | public function isNonsingular() |
191 | 191 | { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * Solve A*X = B |
220 | 220 | * |
221 | - * @param $B A Matrix with as many rows as A and any number of columns. |
|
221 | + * @param Matrix $B A Matrix with as many rows as A and any number of columns. |
|
222 | 222 | * @return X so that L*U*X = B(piv,:) |
223 | 223 | * @\PHPExcel\Calculation\Exception IllegalArgumentException Matrix row dimensions must agree. |
224 | 224 | * @\PHPExcel\Calculation\Exception RuntimeException Matrix is singular. |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | // Find pivot and exchange if necessary. |
96 | 96 | $p = $j; |
97 | - for ($i = $j+1; $i < $this->m; ++$i) { |
|
97 | + for ($i = $j + 1; $i < $this->m; ++$i) { |
|
98 | 98 | if (abs($LUcolj[$i]) > abs($LUcolj[$p])) { |
99 | 99 | $p = $i; |
100 | 100 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | // Compute multipliers. |
114 | 114 | if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) { |
115 | - for ($i = $j+1; $i < $this->m; ++$i) { |
|
115 | + for ($i = $j + 1; $i < $this->m; ++$i) { |
|
116 | 116 | $this->LU[$i][$j] /= $this->LU[$j][$j]; |
117 | 117 | } |
118 | 118 | } |
@@ -229,17 +229,17 @@ discard block |
||
229 | 229 | if ($this->isNonsingular()) { |
230 | 230 | // Copy right hand side with pivoting |
231 | 231 | $nx = $B->getColumnDimension(); |
232 | - $X = $B->getMatrix($this->piv, 0, $nx-1); |
|
232 | + $X = $B->getMatrix($this->piv, 0, $nx - 1); |
|
233 | 233 | // Solve L*Y = B(piv,:) |
234 | 234 | for ($k = 0; $k < $this->n; ++$k) { |
235 | - for ($i = $k+1; $i < $this->n; ++$i) { |
|
235 | + for ($i = $k + 1; $i < $this->n; ++$i) { |
|
236 | 236 | for ($j = 0; $j < $nx; ++$j) { |
237 | 237 | $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k]; |
238 | 238 | } |
239 | 239 | } |
240 | 240 | } |
241 | 241 | // Solve U*X = Y; |
242 | - for ($k = $this->n-1; $k >= 0; --$k) { |
|
242 | + for ($k = $this->n - 1; $k >= 0; --$k) { |
|
243 | 243 | for ($j = 0; $j < $nx; ++$j) { |
244 | 244 | $X->A[$k][$j] /= $this->LU[$k][$k]; |
245 | 245 | } |