当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Shared_JAMA_Matrix::times方法代码示例

本文整理汇总了PHP中PHPExcel_Shared_JAMA_Matrix::times方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Shared_JAMA_Matrix::times方法的具体用法?PHP PHPExcel_Shared_JAMA_Matrix::times怎么用?PHP PHPExcel_Shared_JAMA_Matrix::times使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Shared_JAMA_Matrix的用法示例。


在下文中一共展示了PHPExcel_Shared_JAMA_Matrix::times方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MMULT

 /**
  * MMULT
  *
  * @param	array	$matrixData1	A matrix of values
  * @param	array	$matrixData2	A matrix of values
  * @return	array
  */
 public static function MMULT($matrixData1, $matrixData2)
 {
     $matrixAData = $matrixBData = array();
     if (!is_array($matrixData1)) {
         $matrixData1 = array(array($matrixData1));
     }
     if (!is_array($matrixData2)) {
         $matrixData2 = array(array($matrixData2));
     }
     try {
         $rowA = 0;
         foreach ($matrixData1 as $matrixRow) {
             if (!is_array($matrixRow)) {
                 $matrixRow = array($matrixRow);
             }
             $columnA = 0;
             foreach ($matrixRow as $matrixCell) {
                 if (!is_numeric($matrixCell) || $matrixCell === null) {
                     return PHPExcel_Calculation_Functions::VALUE();
                 }
                 $matrixAData[$rowA][$columnA] = $matrixCell;
                 ++$columnA;
             }
             ++$rowA;
         }
         $matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
         $rowB = 0;
         foreach ($matrixData2 as $matrixRow) {
             if (!is_array($matrixRow)) {
                 $matrixRow = array($matrixRow);
             }
             $columnB = 0;
             foreach ($matrixRow as $matrixCell) {
                 if (!is_numeric($matrixCell) || $matrixCell === null) {
                     return PHPExcel_Calculation_Functions::VALUE();
                 }
                 $matrixBData[$rowB][$columnB] = $matrixCell;
                 ++$columnB;
             }
             ++$rowB;
         }
         $matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
         if ($columnA != $rowB) {
             return PHPExcel_Calculation_Functions::VALUE();
         }
         return $matrixA->times($matrixB)->getArray();
     } catch (PHPExcel_Exception $ex) {
         var_dump($ex->getMessage());
         return PHPExcel_Calculation_Functions::VALUE();
     }
 }
开发者ID:Princelo,项目名称:bioerp,代码行数:58,代码来源:MathTrig.php

示例2: MMULT

 /**
  * MMULT
  *
  * @param	array	$matrixData1	A matrix of values
  * @param	array	$matrixData2	A matrix of values
  * @return	array
  */
 public static function MMULT($matrixData1, $matrixData2)
 {
     $matrixAData = $matrixBData = array();
     if (!is_array($matrixData1)) {
         $matrixData1 = array(array($matrixData1));
     }
     if (!is_array($matrixData2)) {
         $matrixData2 = array(array($matrixData2));
     }
     $rowA = 0;
     foreach ($matrixData1 as $matrixRow) {
         $columnA = 0;
         foreach ($matrixRow as $matrixCell) {
             if (is_string($matrixCell) || $matrixCell === null) {
                 return PHPExcel_Calculation_Functions::VALUE();
             }
             $matrixAData[$rowA][$columnA] = $matrixCell;
             ++$columnA;
         }
         ++$rowA;
     }
     try {
         $matrixA = new PHPExcel_Shared_JAMA_Matrix($matrixAData);
         $rowB = 0;
         foreach ($matrixData2 as $matrixRow) {
             $columnB = 0;
             foreach ($matrixRow as $matrixCell) {
                 if (is_string($matrixCell) || $matrixCell === null) {
                     return PHPExcel_Calculation_Functions::VALUE();
                 }
                 $matrixBData[$rowB][$columnB] = $matrixCell;
                 ++$columnB;
             }
             ++$rowB;
         }
         $matrixB = new PHPExcel_Shared_JAMA_Matrix($matrixBData);
         if ($rowA != $columnB || $rowB != $columnA) {
             return PHPExcel_Calculation_Functions::VALUE();
         }
         return $matrixA->times($matrixB)->getArray();
     } catch (Exception $ex) {
         return PHPExcel_Calculation_Functions::VALUE();
     }
 }
开发者ID:echoOly,项目名称:php_base,代码行数:51,代码来源:MathTrig.php


注:本文中的PHPExcel_Shared_JAMA_Matrix::times方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。