public static function PHPExcel_Calculation_MathTrig::SUMXMY2 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::SUMXMY2()
* SUMXMY2 * *
Parameters
mixed[] $matrixData1 Matrix #1: * @param mixed[] $matrixData2 Matrix #2 * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ MathTrig.php, line 1326
Class
- PHPExcel_Calculation_MathTrig
- PHPExcel_Calculation_MathTrig
Code
public static function SUMXMY2($matrixData1, $matrixData2) {
$array1 = PHPExcel_Calculation_Functions::flattenArray($matrixData1);
$array2 = PHPExcel_Calculation_Functions::flattenArray($matrixData2);
$count1 = count($array1);
$count2 = count($array2);
if ($count1 < $count2) {
$count = $count1;
}
else {
$count = $count2;
}
$result = 0;
for ($i = 0; $i < $count; ++$i) {
if (is_numeric($array1[$i]) && !is_string($array1[$i]) && (is_numeric($array2[$i]) && !is_string($array2[$i]))) {
$result += ($array1[$i] - $array2[$i]) * ($array1[$i] - $array2[$i]);
}
}
return $result;
}