Memory and Performance Improvements

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@64204 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-11-23 17:24:29 +00:00
parent 4da85678d4
commit 9641c16df0
19 changed files with 141 additions and 647 deletions

View File

@ -30,12 +30,6 @@
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }

View File

@ -25,6 +25,14 @@
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
class PHPExcel_Autoloader class PHPExcel_Autoloader
{ {
public static function Register() { public static function Register() {

View File

@ -33,17 +33,7 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
} }
}
/** Matrix */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php';
/** /**
@ -199,9 +189,9 @@ class PHPExcel_Calculation {
// Constant conversion from text name/value to actual (datatyped) value // Constant conversion from text name/value to actual (datatyped) value
private static $_ExcelConstants = array('TRUE' => True, private static $_ExcelConstants = array('TRUE' => true,
'FALSE' => False, 'FALSE' => false,
'NULL' => Null 'NULL' => null
); );
// PHPExcel functions // PHPExcel functions
@ -1718,9 +1708,9 @@ class PHPExcel_Calculation {
($returnType == self::RETURN_ARRAY_AS_ERROR) || ($returnType == self::RETURN_ARRAY_AS_ERROR) ||
($returnType == self::RETURN_ARRAY_AS_ARRAY)) { ($returnType == self::RETURN_ARRAY_AS_ARRAY)) {
self::$returnArrayAsType = $returnType; self::$returnArrayAsType = $returnType;
return True; return true;
} }
return False; return false;
} // function setExcelCalendar() } // function setExcelCalendar()
@ -1882,7 +1872,7 @@ class PHPExcel_Calculation {
} }
self::$functionReplaceFromExcel = self::$functionReplaceToExcel = self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
self::$functionReplaceFromLocale = self::$functionReplaceToLocale = NULL; self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
self::$_localeLanguage = $locale; self::$_localeLanguage = $locale;
return true; return true;
} }
@ -1896,9 +1886,9 @@ class PHPExcel_Calculation {
for ($i = 0; $i < $strlen; ++$i) { for ($i = 0; $i < $strlen; ++$i) {
$chr = mb_substr($formula,$i,1); $chr = mb_substr($formula,$i,1);
switch ($chr) { switch ($chr) {
case '{' : $inBraces = True; case '{' : $inBraces = true;
break; break;
case '}' : $inBraces = False; case '}' : $inBraces = false;
break; break;
case $fromSeparator : case $fromSeparator :
if (!$inBraces) { if (!$inBraces) {
@ -1912,7 +1902,7 @@ class PHPExcel_Calculation {
private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) { private static function _translateFormula($from,$to,$formula,$fromSeparator,$toSeparator) {
// Convert any Excel function names to the required language // Convert any Excel function names to the required language
if (self::$_localeLanguage !== 'en_us') { if (self::$_localeLanguage !== 'en_us') {
$inBraces = False; $inBraces = false;
// If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators // If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
if (strpos($formula,'"') !== false) { if (strpos($formula,'"') !== false) {
// So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded // So instead we skip replacing in any quoted strings by only replacing in every other array element after we've exploded
@ -1938,8 +1928,8 @@ class PHPExcel_Calculation {
return $formula; return $formula;
} }
private static $functionReplaceFromExcel = NULL; private static $functionReplaceFromExcel = null;
private static $functionReplaceToLocale = NULL; private static $functionReplaceToLocale = null;
public function _translateFormulaToLocale($formula) { public function _translateFormulaToLocale($formula) {
if (is_null(self::$functionReplaceFromExcel)) { if (is_null(self::$functionReplaceFromExcel)) {
@ -1967,8 +1957,8 @@ class PHPExcel_Calculation {
} // function _translateFormulaToLocale() } // function _translateFormulaToLocale()
private static $functionReplaceFromLocale = NULL; private static $functionReplaceFromLocale = null;
private static $functionReplaceToExcel = NULL; private static $functionReplaceToExcel = null;
public function _translateFormulaToEnglish($formula) { public function _translateFormulaToEnglish($formula) {
if (is_null(self::$functionReplaceFromLocale)) { if (is_null(self::$functionReplaceFromLocale)) {
@ -2610,7 +2600,7 @@ class PHPExcel_Calculation {
// should be null in a function call // should be null in a function call
// The guts of the lexical parser // The guts of the lexical parser
// Loop through the formula extracting each operator and operand in turn // Loop through the formula extracting each operator and operand in turn
while(True) { while(true) {
// echo 'Assessing Expression <b>'.substr($formula, $index).'</b><br />'; // echo 'Assessing Expression <b>'.substr($formula, $index).'</b><br />';
$opCharacter = $formula{$index}; // Get the first character of the value at the current index position $opCharacter = $formula{$index}; // Get the first character of the value at the current index position
// echo 'Initial character of expression block is '.$opCharacter.'<br />'; // echo 'Initial character of expression block is '.$opCharacter.'<br />';
@ -2683,18 +2673,18 @@ class PHPExcel_Calculation {
return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack"); return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack");
} }
// Check the argument count // Check the argument count
$argumentCountError = False; $argumentCountError = false;
if (is_numeric($expectedArgumentCount)) { if (is_numeric($expectedArgumentCount)) {
if ($expectedArgumentCount < 0) { if ($expectedArgumentCount < 0) {
// echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount).'<br />'; // echo '$expectedArgumentCount is between 0 and '.abs($expectedArgumentCount).'<br />';
if ($argumentCount > abs($expectedArgumentCount)) { if ($argumentCount > abs($expectedArgumentCount)) {
$argumentCountError = True; $argumentCountError = true;
$expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount); $expectedArgumentCountString = 'no more than '.abs($expectedArgumentCount);
} }
} else { } else {
// echo '$expectedArgumentCount is numeric '.$expectedArgumentCount.'<br />'; // echo '$expectedArgumentCount is numeric '.$expectedArgumentCount.'<br />';
if ($argumentCount != $expectedArgumentCount) { if ($argumentCount != $expectedArgumentCount) {
$argumentCountError = True; $argumentCountError = true;
$expectedArgumentCountString = $expectedArgumentCount; $expectedArgumentCountString = $expectedArgumentCount;
} }
} }
@ -2705,19 +2695,19 @@ class PHPExcel_Calculation {
switch ($argMatch[2]) { switch ($argMatch[2]) {
case '+' : case '+' :
if ($argumentCount < $argMatch[1]) { if ($argumentCount < $argMatch[1]) {
$argumentCountError = True; $argumentCountError = true;
$expectedArgumentCountString = $argMatch[1].' or more '; $expectedArgumentCountString = $argMatch[1].' or more ';
} }
break; break;
case '-' : case '-' :
if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) { if (($argumentCount < $argMatch[1]) || ($argumentCount > $argMatch[3])) {
$argumentCountError = True; $argumentCountError = true;
$expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3]; $expectedArgumentCountString = 'between '.$argMatch[1].' and '.$argMatch[3];
} }
break; break;
case ',' : case ',' :
if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) { if (($argumentCount != $argMatch[1]) && ($argumentCount != $argMatch[3])) {
$argumentCountError = True; $argumentCountError = true;
$expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3]; $expectedArgumentCountString = 'either '.$argMatch[1].' or '.$argMatch[3];
} }
break; break;
@ -2738,7 +2728,7 @@ class PHPExcel_Calculation {
// If we've a comma when we're expecting an operand, then what we actually have is a null operand; // If we've a comma when we're expecting an operand, then what we actually have is a null operand;
// so push a null onto the stack // so push a null onto the stack
if (($expectingOperand) || (!$expectingOperator)) { if (($expectingOperand) || (!$expectingOperator)) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => NULL); $output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
} }
// make sure there was a function // make sure there was a function
$d = $stack->last(2); $d = $stack->last(2);
@ -2778,7 +2768,7 @@ class PHPExcel_Calculation {
} }
$stack->push('Brace', '('); $stack->push('Brace', '(');
} else { // it's a var w/ implicit multiplication } else { // it's a var w/ implicit multiplication
$output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => NULL); $output[] = array('type' => 'Value', 'value' => $matches[1], 'reference' => null);
} }
} elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) { } elseif (preg_match('/^'.self::CALCULATION_REGEXP_CELLREF.'$/i', $val, $matches)) {
// echo 'Element '.$val.' is a Cell reference<br />'; // echo 'Element '.$val.' is a Cell reference<br />';
@ -2840,7 +2830,7 @@ class PHPExcel_Calculation {
$val = self::_wrapResult(str_replace('""','"',self::_unwrapResult($val))); $val = self::_wrapResult(str_replace('""','"',self::_unwrapResult($val)));
} elseif (is_numeric($val)) { } elseif (is_numeric($val)) {
// echo 'Element is a Number<br />'; // echo 'Element is a Number<br />';
if ((strpos($val,'.') !== False) || (stripos($val,'e') !== False) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) { if ((strpos($val,'.') !== false) || (stripos($val,'e') !== false) || ($val > PHP_INT_MAX) || ($val < -PHP_INT_MAX)) {
// echo 'Casting '.$val.' to float<br />'; // echo 'Casting '.$val.' to float<br />';
$val = (float) $val; $val = (float) $val;
} else { } else {
@ -2855,7 +2845,7 @@ class PHPExcel_Calculation {
// echo 'Element '.$localeConstant.' is an Excel Constant<br />'; // echo 'Element '.$localeConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$localeConstant]; $val = self::$_ExcelConstants[$localeConstant];
} }
$details = array('type' => 'Value', 'value' => $val, 'reference' => NULL); $details = array('type' => 'Value', 'value' => $val, 'reference' => null);
if ($localeConstant) { $details['localeValue'] = $localeConstant; } if ($localeConstant) { $details['localeValue'] = $localeConstant; }
$output[] = $details; $output[] = $details;
} }
@ -2865,9 +2855,9 @@ class PHPExcel_Calculation {
++$index; ++$index;
} elseif ($opCharacter == ')') { // miscellaneous error checking } elseif ($opCharacter == ')') { // miscellaneous error checking
if ($expectingOperand) { if ($expectingOperand) {
$output[] = array('type' => 'Null Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => NULL); $output[] = array('type' => 'Null Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
$expectingOperand = false; $expectingOperand = false;
$expectingOperator = True; $expectingOperator = true;
} else { } else {
return $this->_raiseFormulaError("Formula Error: Unexpected ')'"); return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
} }
@ -3008,7 +2998,7 @@ class PHPExcel_Calculation {
} }
$stack->push('Cell Reference',$cellValue,$cellRef); $stack->push('Cell Reference',$cellValue,$cellRef);
} else { } else {
$stack->push('Error',PHPExcel_Calculation_Functions::REF(),NULL); $stack->push('Error',PHPExcel_Calculation_Functions::REF(),null);
} }
break; break;
@ -3042,7 +3032,7 @@ class PHPExcel_Calculation {
self::_checkMatrixOperands($operand1,$operand2,2); self::_checkMatrixOperands($operand1,$operand2,2);
try { try {
// Convert operand 1 from a PHP array to a matrix // Convert operand 1 from a PHP array to a matrix
$matrix = new Matrix($operand1); $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
// Perform the required operation against the operand 1 matrix, passing in operand 2 // Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->concat($operand2); $matrixResult = $matrix->concat($operand2);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
@ -3089,7 +3079,7 @@ class PHPExcel_Calculation {
if (is_array($arg)) { if (is_array($arg)) {
self::_checkMatrixOperands($arg,$multiplier,2); self::_checkMatrixOperands($arg,$multiplier,2);
try { try {
$matrix1 = new Matrix($arg); $matrix1 = new PHPExcel_Shared_JAMA_Matrix($arg);
$matrixResult = $matrix1->arrayTimesEquals($multiplier); $matrixResult = $matrix1->arrayTimesEquals($multiplier);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
} catch (Exception $ex) { } catch (Exception $ex) {
@ -3150,7 +3140,7 @@ class PHPExcel_Calculation {
$cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false); $cellValue = $this->extractCellRange($cellRef, $pCellParent->getParent()->getSheetByName($matches[2]), false);
$pCell->attach($pCellParent); $pCell->attach($pCellParent);
} else { } else {
$cellValue = NULL; $cellValue = null;
} }
} else { } else {
return $this->_raiseFormulaError('Unable to access Cell Reference'); return $this->_raiseFormulaError('Unable to access Cell Reference');
@ -3164,7 +3154,7 @@ class PHPExcel_Calculation {
$cellValue = $this->extractCellRange($cellRef, $pCellParent, false); $cellValue = $this->extractCellRange($cellRef, $pCellParent, false);
$pCell->attach($pCellParent); $pCell->attach($pCellParent);
} else { } else {
$cellValue = NULL; $cellValue = null;
} }
$this->_writeDebug('Evaluation Result for cell '.$cellRef.' is '.$this->_showTypeDetails($cellValue)); $this->_writeDebug('Evaluation Result for cell '.$cellRef.' is '.$this->_showTypeDetails($cellValue));
} }
@ -3356,7 +3346,7 @@ class PHPExcel_Calculation {
if (!$recursingArrays) { self::_checkMatrixOperands($operand1,$operand2,2); } if (!$recursingArrays) { self::_checkMatrixOperands($operand1,$operand2,2); }
foreach($operand1 as $x => $operandData) { foreach($operand1 as $x => $operandData) {
$this->_writeDebug('Evaluating '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2[$x])); $this->_writeDebug('Evaluating '.$this->_showValue($operandData).' '.$operation.' '.$this->_showValue($operand2[$x]));
$this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,True); $this->_executeBinaryComparisonOperation($cellID,$operandData,$operand2[$x],$operation,$stack,true);
$r = $stack->pop(); $r = $stack->pop();
$result[$x] = $r['value']; $result[$x] = $r['value'];
} }
@ -3434,7 +3424,7 @@ class PHPExcel_Calculation {
if ($executeMatrixOperation) { if ($executeMatrixOperation) {
try { try {
// Convert operand 1 from a PHP array to a matrix // Convert operand 1 from a PHP array to a matrix
$matrix = new Matrix($operand1); $matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
// Perform the required operation against the operand 1 matrix, passing in operand 2 // Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->$matrixFunction($operand2); $matrixResult = $matrix->$matrixFunction($operand2);
$result = $matrixResult->getArray(); $result = $matrixResult->getArray();
@ -3532,7 +3522,7 @@ class PHPExcel_Calculation {
if ($pSheet->cellExists($aReferences[0])) { if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = NULL; $returnValue[$currentRow][$currentCol] = null;
} }
} else { } else {
// Extract cell data // Extract cell data
@ -3543,7 +3533,7 @@ class PHPExcel_Calculation {
if ($pSheet->cellExists($reference)) { if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = NULL; $returnValue[$currentRow][$currentCol] = null;
} }
} }
} }
@ -3604,7 +3594,7 @@ class PHPExcel_Calculation {
if ($pSheet->cellExists($aReferences[0])) { if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = NULL; $returnValue[$currentRow][$currentCol] = null;
} }
} else { } else {
// Extract cell data // Extract cell data
@ -3615,7 +3605,7 @@ class PHPExcel_Calculation {
if ($pSheet->cellExists($reference)) { if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog); $returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else { } else {
$returnValue[$currentRow][$currentCol] = NULL; $returnValue[$currentRow][$currentCol] = null;
} }
} }
} }

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -64,12 +64,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -33,12 +33,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
/** /**

View File

@ -32,12 +32,6 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }

View File

@ -3,9 +3,6 @@
* @package JAMA * @package JAMA
*/ */
define('RAND_MAX', mt_getrandmax());
define('RAND_MIN', 0);
/** PHPExcel root directory */ /** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) { if (!defined('PHPEXCEL_ROOT')) {
/** /**
@ -13,23 +10,8 @@ if (!defined('PHPEXCEL_ROOT')) {
*/ */
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../'); define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
} }
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/utils/Error.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/utils/Maths.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/CholeskyDecomposition.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/LUDecomposition.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/QRDecomposition.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/EigenvalueDecomposition.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/SingularValueDecomposition.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Functions.php';
/* /*
* Matrix class * Matrix class
@ -42,7 +24,14 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Functions.php';
* @license PHP v3.0 * @license PHP v3.0
* @see http://math.nist.gov/javanumerics/jama/ * @see http://math.nist.gov/javanumerics/jama/
*/ */
class Matrix { class PHPExcel_Shared_JAMA_Matrix {
const PolymorphicArgumentException = "Invalid argument pattern for polymorphic function.";
const ArgumentTypeException = "Invalid argument type.";
const ArgumentBoundsException = "Invalid argument range.";
const MatrixDimensionException = "Matrix dimensions are not equal.";
const ArrayLengthException = "Array length must be a multiple of m.";
/** /**
* Matrix storage * Matrix storage
@ -98,24 +87,6 @@ class Matrix {
$this->n = $args[1]; $this->n = $args[1];
$this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0)); $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0));
break; break;
//Rectangular matrix constant-filled - m x n filled with c
case 'integer,integer,integer':
$this->m = $args[0];
$this->n = $args[1];
$this->A = array_fill(0, $this->m, array_fill(0, $this->n, $args[2]));
break;
//Rectangular matrix constant-filled - m x n filled with c
case 'integer,integer,double':
$this->m = $args[0];
$this->n = $args[1];
$this->A = array_fill(0, $this->m, array_fill(0, $this->n, $args[2]));
break;
//Rectangular matrix - m x n initialized from 2D array
case 'array,integer,integer':
$this->m = $args[1];
$this->n = $args[2];
$this->A = $args[0];
break;
//Rectangular matrix - m x n initialized from packed array //Rectangular matrix - m x n initialized from packed array
case 'array,integer': case 'array,integer':
$this->m = $args[1]; $this->m = $args[1];
@ -131,15 +102,15 @@ class Matrix {
} }
} }
} else { } else {
throw new Exception(JAMAError(ArrayLengthException)); throw new Exception(self::ArrayLengthException);
} }
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function __construct() } // function __construct()
@ -154,73 +125,6 @@ class Matrix {
} // function getArray() } // function getArray()
/**
* getArrayCopy
*
* @return array Matrix array copy
*/
public function getArrayCopy() {
return $this->A;
} // function getArrayCopy()
/**
* constructWithCopy
* Construct a matrix from a copy of a 2-D array.
*
* @param double A[][] Two-dimensional array of doubles.
* @exception IllegalArgumentException All rows must have the same length
*/
public function constructWithCopy($A) {
$this->m = count($A);
$this->n = count($A[0]);
$newCopyMatrix = new Matrix($this->m, $this->n);
for ($i = 0; $i < $this->m; ++$i) {
if (count($A[$i]) != $this->n) {
throw new Exception(JAMAError(RowLengthException));
}
for ($j = 0; $j < $this->n; ++$j) {
$newCopyMatrix->A[$i][$j] = $A[$i][$j];
}
}
return $newCopyMatrix;
} // function constructWithCopy()
/**
* getColumnPackedCopy
*
* Get a column-packed array
* @return array Column-packed matrix array
*/
public function getColumnPackedCopy() {
$P = array();
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
array_push($P, $this->A[$j][$i]);
}
}
return $P;
} // function getColumnPackedCopy()
/**
* getRowPackedCopy
*
* Get a row-packed array
* @return array Row-packed matrix array
*/
public function getRowPackedCopy() {
$P = array();
for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) {
array_push($P, $this->A[$i][$j]);
}
}
return $P;
} // function getRowPackedCopy()
/** /**
* getRowDimension * getRowDimension
* *
@ -273,9 +177,9 @@ class Matrix {
//A($i0...; $j0...) //A($i0...; $j0...)
case 'integer,integer': case 'integer,integer':
list($i0, $j0) = $args; list($i0, $j0) = $args;
if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if ($i0 >= 0) { $m = $this->m - $i0; } else { throw new Exception(self::ArgumentBoundsException); }
if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if ($j0 >= 0) { $n = $this->n - $j0; } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $this->m; ++$i) { for($i = $i0; $i < $this->m; ++$i) {
for($j = $j0; $j < $this->n; ++$j) { for($j = $j0; $j < $this->n; ++$j) {
$R->set($i, $j, $this->A[$i][$j]); $R->set($i, $j, $this->A[$i][$j]);
@ -286,9 +190,9 @@ class Matrix {
//A($i0...$iF; $j0...$jF) //A($i0...$iF; $j0...$jF)
case 'integer,integer,integer,integer': case 'integer,integer,integer,integer':
list($i0, $iF, $j0, $jF) = $args; list($i0, $iF, $j0, $jF) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(self::ArgumentBoundsException); }
if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m+1, $n+1); $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
for($i = $i0; $i <= $iF; ++$i) { for($i = $i0; $i <= $iF; ++$i) {
for($j = $j0; $j <= $jF; ++$j) { for($j = $j0; $j <= $jF; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$i][$j]); $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
@ -299,9 +203,9 @@ class Matrix {
//$R = array of row indices; $C = array of column indices //$R = array of row indices; $C = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) { for($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) { for($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]); $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
@ -312,9 +216,9 @@ class Matrix {
//$RL = array of row indices; $CL = array of column indices //$RL = array of row indices; $CL = array of column indices
case 'array,array': case 'array,array':
list($RL, $CL) = $args; list($RL, $CL) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) { for($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) { for($j = 0; $j < $n; ++$j) {
$R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]); $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
@ -325,9 +229,9 @@ class Matrix {
//A($i0...$iF); $CL = array of column indices //A($i0...$iF); $CL = array of column indices
case 'integer,integer,array': case 'integer,integer,array':
list($i0, $iF, $CL) = $args; list($i0, $iF, $CL) = $args;
if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) { $m = $iF - $i0; } else { throw new Exception(self::ArgumentBoundsException); }
if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($CL) > 0) { $n = count($CL); } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = $i0; $i < $iF; ++$i) { for($i = $i0; $i < $iF; ++$i) {
for($j = 0; $j < $n; ++$j) { for($j = 0; $j < $n; ++$j) {
$R->set($i - $i0, $j, $this->A[$RL[$i]][$j]); $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
@ -338,9 +242,9 @@ class Matrix {
//$RL = array of row indices //$RL = array of row indices
case 'array,integer,integer': case 'array,integer,integer':
list($RL, $j0, $jF) = $args; list($RL, $j0, $jF) = $args;
if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (count($RL) > 0) { $m = count($RL); } else { throw new Exception(self::ArgumentBoundsException); }
if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(JAMAError(ArgumentBoundsException)); } if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) { $n = $jF - $j0; } else { throw new Exception(self::ArgumentBoundsException); }
$R = new Matrix($m, $n+1); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
for($i = 0; $i < $m; ++$i) { for($i = 0; $i < $m; ++$i) {
for($j = $j0; $j <= $jF; ++$j) { for($j = $j0; $j <= $jF; ++$j) {
$R->set($i, $j - $j0, $this->A[$RL[$i]][$j]); $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
@ -349,61 +253,15 @@ class Matrix {
return $R; return $R;
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function getMatrix() } // function getMatrix()
/**
* setMatrix
*
* Set a submatrix
* @param int $i0 Initial row index
* @param int $j0 Initial column index
* @param mixed $S Matrix/Array submatrix
* ($i0, $j0, $S) $S = Matrix
* ($i0, $j0, $S) $S = Array
*/
public function setMatrix() {
if (func_num_args() > 0) {
$args = func_get_args();
$match = implode(",", array_map('gettype', $args));
switch($match) {
case 'integer,integer,object':
if ($args[2] instanceof Matrix) { $M = $args[2]; } else { throw new Exception(JAMAError(ArgumentTypeException)); }
if (($args[0] + $M->m) <= $this->m) { $i0 = $args[0]; } else { throw new Exception(JAMAError(ArgumentBoundsException)); }
if (($args[1] + $M->n) <= $this->n) { $j0 = $args[1]; } else { throw new Exception(JAMAError(ArgumentBoundsException)); }
for($i = $i0; $i < $i0 + $M->m; ++$i) {
for($j = $j0; $j < $j0 + $M->n; ++$j) {
$this->A[$i][$j] = $M->get($i - $i0, $j - $j0);
}
}
break;
case 'integer,integer,array':
$M = new Matrix($args[2]);
if (($args[0] + $M->m) <= $this->m) { $i0 = $args[0]; } else { throw new Exception(JAMAError(ArgumentBoundsException)); }
if (($args[1] + $M->n) <= $this->n) { $j0 = $args[1]; } else { throw new Exception(JAMAError(ArgumentBoundsException)); }
for($i = $i0; $i < $i0 + $M->m; ++$i) {
for($j = $j0; $j < $j0 + $M->n; ++$j) {
$this->A[$i][$j] = $M->get($i - $i0, $j - $j0);
}
}
break;
default:
throw new Exception(JAMAError(PolymorphicArgumentException));
break;
}
} else {
throw new Exception(JAMAError(PolymorphicArgumentException));
}
} // function setMatrix()
/** /**
* checkMatrixDimensions * checkMatrixDimensions
* *
@ -412,14 +270,14 @@ class Matrix {
* @return boolean * @return boolean
*/ */
public function checkMatrixDimensions($B = null) { public function checkMatrixDimensions($B = null) {
if ($B instanceof Matrix) { if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) { if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) {
return true; return true;
} else { } else {
throw new Exception(JAMAError(MatrixDimensionException)); throw new Exception(self::MatrixDimensionException);
} }
} else { } else {
throw new Exception(JAMAError(ArgumentTypeException)); throw new Exception(self::ArgumentTypeException);
} }
} // function checkMatrixDimensions() } // function checkMatrixDimensions()
@ -437,18 +295,6 @@ class Matrix {
public function set($i = null, $j = null, $c = null) { public function set($i = null, $j = null, $c = null) {
// Optimized set version just has this // Optimized set version just has this
$this->A[$i][$j] = $c; $this->A[$i][$j] = $c;
/*
if (is_int($i) && is_int($j) && is_numeric($c)) {
if (($i < $this->m) && ($j < $this->n)) {
$this->A[$i][$j] = $c;
} else {
echo "A[$i][$j] = $c<br />";
throw new Exception(JAMAError(ArgumentBoundsException));
}
} else {
throw new Exception(JAMAError(ArgumentTypeException));
}
*/
} // function set() } // function set()
@ -475,7 +321,7 @@ class Matrix {
* @return Matrix Diagonal matrix * @return Matrix Diagonal matrix
*/ */
public function diagonal($m = null, $n = null, $c = 1) { public function diagonal($m = null, $n = null, $c = 1) {
$R = new Matrix($m, $n); $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
for($i = 0; $i < $m; ++$i) { for($i = 0; $i < $m; ++$i) {
$R->set($i, $i, $c); $R->set($i, $i, $c);
} }
@ -483,58 +329,6 @@ class Matrix {
} // function diagonal() } // function diagonal()
/**
* filled
*
* Generate a filled matrix
* @param int $m Row dimension
* @param int $n Column dimension
* @param int $c Fill constant
* @return Matrix Filled matrix
*/
public function filled($m = null, $n = null, $c = 0) {
if (is_int($m) && is_int($n) && is_numeric($c)) {
$R = new Matrix($m, $n, $c);
return $R;
} else {
throw new Exception(JAMAError(ArgumentTypeException));
}
} // function filled()
/**
* random
*
* Generate a random matrix
* @param int $m Row dimension
* @param int $n Column dimension
* @return Matrix Random matrix
*/
public function random($m = null, $n = null, $a = RAND_MIN, $b = RAND_MAX) {
if (is_int($m) && is_int($n) && is_numeric($a) && is_numeric($b)) {
$R = new Matrix($m, $n);
for($i = 0; $i < $m; ++$i) {
for($j = 0; $j < $n; ++$j) {
$R->set($i, $j, mt_rand($a, $b));
}
}
return $R;
} else {
throw new Exception(JAMAError(ArgumentTypeException));
}
} // function random()
/**
* packed
*
* Alias for getRowPacked
* @return array Packed array
*/
public function packed() {
return $this->getRowPacked();
} // function packed()
/** /**
* getMatrixByRow * getMatrixByRow
* *
@ -551,7 +345,7 @@ class Matrix {
return $this->getMatrix($i0, 0, $i0 + 1, $this->n); return $this->getMatrix($i0, 0, $i0 + 1, $this->n);
} }
} else { } else {
throw new Exception(JAMAError(ArgumentTypeException)); throw new Exception(self::ArgumentTypeException);
} }
} // function getMatrixByRow() } // function getMatrixByRow()
@ -572,7 +366,7 @@ class Matrix {
return $this->getMatrix(0, $j0, $this->m, $j0 + 1); return $this->getMatrix(0, $j0, $this->m, $j0 + 1);
} }
} else { } else {
throw new Exception(JAMAError(ArgumentTypeException)); throw new Exception(self::ArgumentTypeException);
} }
} // function getMatrixByCol() } // function getMatrixByCol()
@ -584,7 +378,7 @@ class Matrix {
* @return Matrix Transposed matrix * @return Matrix Transposed matrix
*/ */
public function transpose() { public function transpose() {
$R = new Matrix($this->n, $this->m); $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
for($i = 0; $i < $this->m; ++$i) { for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for($j = 0; $j < $this->n; ++$j) {
$R->set($j, $i, $this->A[$i][$j]); $R->set($j, $i, $this->A[$i][$j]);
@ -594,93 +388,6 @@ class Matrix {
} // function transpose() } // function transpose()
/**
* norm1
*
* One norm
* @return float Maximum column sum
*/
public function norm1() {
$r = 0;
for($j = 0; $j < $this->n; ++$j) {
$s = 0;
for($i = 0; $i < $this->m; ++$i) {
$s += abs($this->A[$i][$j]);
}
$r = ($r > $s) ? $r : $s;
}
return $r;
} // function norm1()
/**
* norm2
*
* Maximum singular value
* @return float Maximum singular value
*/
public function norm2() {
} // function norm2()
/**
* normInf
*
* Infinite norm
* @return float Maximum row sum
*/
public function normInf() {
$r = 0;
for($i = 0; $i < $this->m; ++$i) {
$s = 0;
for($j = 0; $j < $this->n; ++$j) {
$s += abs($this->A[$i][$j]);
}
$r = ($r > $s) ? $r : $s;
}
return $r;
} // function normInf()
/**
* normF
*
* Frobenius norm
* @return float Square root of the sum of all elements squared
*/
public function normF() {
$f = 0;
for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) {
$f = hypo($f,$this->A[$i][$j]);
}
}
return $f;
} // function normF()
/**
* Matrix rank
*
* @return effective numerical rank, obtained from SVD.
*/
public function rank () {
$svd = new SingularValueDecomposition($this);
return $svd->rank();
} // function rank ()
/**
* Matrix condition (2 norm)
*
* @return ratio of largest to smallest singular value.
*/
public function cond () {
$svd = new SingularValueDecomposition($this);
return $svd->cond();
} // function cond ()
/** /**
* trace * trace
* *
@ -721,13 +428,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -738,7 +445,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function plus() } // function plus()
@ -757,13 +464,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -788,7 +495,7 @@ class Matrix {
} }
return $this; return $this;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function plusEquals() } // function plusEquals()
@ -807,13 +514,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -824,7 +531,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function minus() } // function minus()
@ -843,13 +550,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -874,7 +581,7 @@ class Matrix {
} }
return $this; return $this;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function minusEquals() } // function minusEquals()
@ -894,13 +601,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -911,7 +618,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayTimes() } // function arrayTimes()
@ -931,13 +638,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -962,7 +669,7 @@ class Matrix {
} }
return $this; return $this;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayTimesEquals() } // function arrayTimesEquals()
@ -982,13 +689,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -1018,7 +725,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayRightDivide() } // function arrayRightDivide()
@ -1038,13 +745,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -1055,7 +762,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayRightDivideEquals() } // function arrayRightDivideEquals()
@ -1075,13 +782,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -1092,7 +799,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayLeftDivide() } // function arrayLeftDivide()
@ -1112,13 +819,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -1129,7 +836,7 @@ class Matrix {
} }
return $M; return $M;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function arrayLeftDivideEquals() } // function arrayLeftDivideEquals()
@ -1148,9 +855,9 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $B = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $B = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
if ($this->n == $B->m) { if ($this->n == $B->m) {
$C = new Matrix($this->m, $B->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for($j = 0; $j < $B->n; ++$j) { for($j = 0; $j < $B->n; ++$j) {
for ($k = 0; $k < $this->n; ++$k) { for ($k = 0; $k < $this->n; ++$k) {
$Bcolj[$k] = $B->A[$k][$j]; $Bcolj[$k] = $B->A[$k][$j];
@ -1170,9 +877,9 @@ class Matrix {
} }
break; break;
case 'array': case 'array':
$B = new Matrix($args[0]); $B = new PHPExcel_Shared_JAMA_Matrix($args[0]);
if ($this->n == $B->m) { if ($this->n == $B->m) {
$C = new Matrix($this->m, $B->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
for($i = 0; $i < $C->m; ++$i) { for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for($j = 0; $j < $C->n; ++$j) {
$s = "0"; $s = "0";
@ -1189,7 +896,7 @@ class Matrix {
return $M; return $M;
break; break;
case 'integer': case 'integer':
$C = new Matrix($this->A); $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) { for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0]; $C->A[$i][$j] *= $args[0];
@ -1198,7 +905,7 @@ class Matrix {
return $C; return $C;
break; break;
case 'double': case 'double':
$C = new Matrix($this->m, $this->n); $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n);
for($i = 0; $i < $C->m; ++$i) { for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] = $args[0] * $this->A[$i][$j]; $C->A[$i][$j] = $args[0] * $this->A[$i][$j];
@ -1207,7 +914,7 @@ class Matrix {
return $C; return $C;
break; break;
case 'float': case 'float':
$C = new Matrix($this->A); $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
for($i = 0; $i < $C->m; ++$i) { for($i = 0; $i < $C->m; ++$i) {
for($j = 0; $j < $C->n; ++$j) { for($j = 0; $j < $C->n; ++$j) {
$C->A[$i][$j] *= $args[0]; $C->A[$i][$j] *= $args[0];
@ -1216,11 +923,11 @@ class Matrix {
return $C; return $C;
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
} else { } else {
throw new Exception(PolymorphicArgumentException); throw new Exception(self::PolymorphicArgumentException);
} }
} // function times() } // function times()
@ -1239,13 +946,13 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
break; break;
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
@ -1270,7 +977,7 @@ class Matrix {
} }
return $this; return $this;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function power() } // function power()
@ -1289,100 +996,27 @@ class Matrix {
switch($match) { switch($match) {
case 'object': case 'object':
if ($args[0] instanceof Matrix) { $M = $args[0]; } else { throw new Exception(JAMAError(ArgumentTypeException)); } if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) { $M = $args[0]; } else { throw new Exception(self::ArgumentTypeException); }
case 'array': case 'array':
$M = new Matrix($args[0]); $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
break; break;
default: default:
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
break; break;
} }
$this->checkMatrixDimensions($M); $this->checkMatrixDimensions($M);
for($i = 0; $i < $this->m; ++$i) { for($i = 0; $i < $this->m; ++$i) {
for($j = 0; $j < $this->n; ++$j) { for($j = 0; $j < $this->n; ++$j) {
// $this->A[$i][$j] = '"'.trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"').'"';
$this->A[$i][$j] = trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"'); $this->A[$i][$j] = trim($this->A[$i][$j],'"').trim($M->get($i, $j),'"');
} }
} }
return $this; return $this;
} else { } else {
throw new Exception(JAMAError(PolymorphicArgumentException)); throw new Exception(self::PolymorphicArgumentException);
} }
} // function concat() } // function concat()
/**
* chol
*
* Cholesky decomposition
* @return Matrix Cholesky decomposition
*/
public function chol() {
return new CholeskyDecomposition($this);
} // function chol()
/**
* lu
*
* LU decomposition
* @return Matrix LU decomposition
*/
public function lu() {
return new LUDecomposition($this);
} // function lu()
/**
* qr
*
* QR decomposition
* @return Matrix QR decomposition
*/
public function qr() {
return new QRDecomposition($this);
} // function qr()
/**
* eig
*
* Eigenvalue decomposition
* @return Matrix Eigenvalue decomposition
*/
public function eig() {
return new EigenvalueDecomposition($this);
} // function eig()
/**
* svd
*
* Singular value decomposition
* @return Singular value decomposition
*/
public function svd() {
return new SingularValueDecomposition($this);
} // function svd()
/**
* Solve A*X = B.
*
* @param Matrix $B Right hand side
* @return Matrix ... Solution if A is square, least squares solution otherwise
*/
public function solve($B) {
if ($this->m == $this->n) {
$LU = new LUDecomposition($this);
return $LU->solve($B);
} else {
$QR = new QRDecomposition($this);
return $QR->solve($B);
}
} // function solve()
/** /**
* Matrix inverse or pseudoinverse. * Matrix inverse or pseudoinverse.
* *
@ -1393,53 +1027,4 @@ class Matrix {
} // function inverse() } // function inverse()
/**
* det
*
* Calculate determinant
* @return float Determinant
*/
public function det() {
$L = new LUDecomposition($this);
return $L->det();
} // function det()
/**
* Older debugging utility for backwards compatability.
*
* @return html version of matrix
*/
public function mprint($A, $format="%01.2f", $width=2) {
$m = count($A);
$n = count($A[0]);
$spacing = str_repeat('&nbsp;',$width);
for ($i = 0; $i < $m; ++$i) {
for ($j = 0; $j < $n; ++$j) {
$formatted = sprintf($format, $A[$i][$j]);
echo $formatted.$spacing;
}
echo "<br />";
}
} // function mprint()
/**
* Debugging utility.
*
* @return Output HTML representation of matrix
*/
public function toHTML($width=2) {
print('<table style="background-color:#eee;">');
for($i = 0; $i < $this->m; ++$i) {
print('<tr>');
for($j = 0; $j < $this->n; ++$j) {
print('<td style="background-color:#fff;border:1px solid #000;padding:2px;text-align:center;vertical-align:middle;">' . $this->A[$i][$j] . '</td>');
}
print('</tr>');
}
print('</table>');
} // function toHTML()
} // class Matrix } // class Matrix

View File

@ -34,6 +34,7 @@ Fixed in SVN:
- Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values - Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values
- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value - Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value
- Feature: (MBaker) Added Contiguous flag for the CSV Reader, when working with Read Filters - Feature: (MBaker) Added Contiguous flag for the CSV Reader, when working with Read Filters
- Feature: (MBaker) Added getFormattedValue() method for cell object
- Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Percent
- Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php
- Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant - Bugfix: (Progi1984) Workitem 7895 - Excel5 : Formula : Error constant