public static function PHPExcel_Calculation_MathTrig::MDETERM in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php \PHPExcel_Calculation_MathTrig::MDETERM()
* MDETERM * * Returns the matrix determinant of an array. * * Excel Function: * MDETERM(array) * * @access public * @category Mathematical and Trigonometric Functions *
Parameters
array $matrixValues A matrix of values: * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ MathTrig.php, line 529
Class
- PHPExcel_Calculation_MathTrig
- PHPExcel_Calculation_MathTrig
Code
public static function MDETERM($matrixValues) {
$matrixData = array();
if (!is_array($matrixValues)) {
$matrixValues = array(
array(
$matrixValues,
),
);
}
$row = $maxColumn = 0;
foreach ($matrixValues as $matrixRow) {
if (!is_array($matrixRow)) {
$matrixRow = array(
$matrixRow,
);
}
$column = 0;
foreach ($matrixRow as $matrixCell) {
if (is_string($matrixCell) || $matrixCell === null) {
return PHPExcel_Calculation_Functions::VALUE();
}
$matrixData[$column][$row] = $matrixCell;
++$column;
}
if ($column > $maxColumn) {
$maxColumn = $column;
}
++$row;
}
if ($row != $maxColumn) {
return PHPExcel_Calculation_Functions::VALUE();
}
try {
$matrix = new PHPExcel_Shared_JAMA_Matrix($matrixData);
return $matrix
->det();
} catch (PHPExcel_Exception $ex) {
return PHPExcel_Calculation_Functions::VALUE();
}
}