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


PHP Matrix::getRowDimension方法代码示例

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


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

示例1: checkMatrixDimensions

 /**
  *    checkMatrixDimensions
  *
  *    Is matrix B the same size?
  *    @param Matrix $B Matrix B
  *    @return boolean
  */
 public function checkMatrixDimensions($B = null)
 {
     if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
         if ($this->m == $B->getRowDimension() && $this->n == $B->getColumnDimension()) {
             return true;
         } else {
             throw new PHPExcel_Calculation_Exception(self::MATRIX_DIMENSION_EXCEPTION);
         }
     } else {
         throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
     }
 }
开发者ID:alyayazilim,项目名称:E-Ticaret-2015,代码行数:19,代码来源:Matrix.php

示例2: checkMatrixDimensions

 /**
  *	checkMatrixDimensions
  *
  *	Is matrix B the same size?
  *	@param Matrix $B Matrix B
  *	@return boolean
  */
 public function checkMatrixDimensions($B = null)
 {
     if ($B instanceof Matrix) {
         if ($this->m == $B->getRowDimension() && $this->n == $B->getColumnDimension()) {
             return true;
         } else {
             throw new Exception(JAMAError(MatrixDimensionException));
         }
     } else {
         throw new Exception(JAMAError(ArgumentTypeException));
     }
 }
开发者ID:bestgoodz,项目名称:toko-baju,代码行数:19,代码来源:Matrix.php

示例3: TestMatrix


//.........这里部分代码省略.........
     if ($tmp - $B->get(0, 0) != 0.0) {
         $errorCount = $this->try_failure($errorCount, "constructWithCopy... ", "copy not effected... data visible outside");
     } else {
         $this->try_success("constructWithCopy... ", "");
     }
     $I = new Matrix($ivals);
     if ($this->checkMatrices($I, Matrix::identity(3, 4))) {
         $this->try_success("identity... ", "");
     } else {
         $errorCount = $this->try_failure($errorCount, "identity... ", "identity Matrix not successfully created");
     }
     /**
      * Access Methods:
      *
      *   getColumnDimension()
      *   getRowDimension()
      *   getArray()
      *   getArrayCopy()
      *   getColumnPackedCopy()
      *   getRowPackedCopy()
      *   get(int,int)
      *   getMatrix(int,int,int,int)
      *   getMatrix(int,int,int[])
      *   getMatrix(int[],int,int)
      *   getMatrix(int[],int[])
      *   set(int,int,double)
      *   setMatrix(int,int,int,int,Matrix)
      *   setMatrix(int,int,int[],Matrix)
      *   setMatrix(int[],int,int,Matrix)
      *   setMatrix(int[],int[],Matrix)
      */
     print "<p>Testing access methods...</p>";
     $B = new Matrix($avals);
     if ($B->getRowDimension() == $rows) {
         $this->try_success("getRowDimension...");
     } else {
         $errorCount = $this->try_failure($errorCount, "getRowDimension...");
     }
     if ($B->getColumnDimension() == $cols) {
         $this->try_success("getColumnDimension...");
     } else {
         $errorCount = $this->try_failure($errorCount, "getColumnDimension...");
     }
     $barray = $B->getArray();
     if ($this->checkArrays($barray, $avals)) {
         $this->try_success("getArray...");
     } else {
         $errorCount = $this->try_failure($errorCount, "getArray...");
     }
     $bpacked = $B->getColumnPackedCopy();
     if ($this->checkArrays($bpacked, $columnwise)) {
         $this->try_success("getColumnPackedCopy...");
     } else {
         $errorCount = $this->try_failure($errorCount, "getColumnPackedCopy...");
     }
     $bpacked = $B->getRowPackedCopy();
     if ($this->checkArrays($bpacked, $rowwise)) {
         $this->try_success("getRowPackedCopy...");
     } else {
         $errorCount = $this->try_failure($errorCount, "getRowPackedCopy...");
     }
     /**
      * Array-like methods:
      *   minus
      *   minusEquals
      *   plus
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:67,代码来源:TestMatrix.php

示例4: solve

 /**
  *	Least squares solution of A*X = B
  *
  *	@param Matrix $B A Matrix with as many rows as A and any number of columns.
  *	@return Matrix Matrix that minimizes the two norm of Q*R*X-B.
  */
 public function solve($B)
 {
     if ($B->getRowDimension() == $this->m) {
         if ($this->isFullRank()) {
             // Copy right hand side
             $nx = $B->getColumnDimension();
             $X = $B->getArrayCopy();
             // Compute Y = transpose(Q)*B
             for ($k = 0; $k < $this->n; ++$k) {
                 for ($j = 0; $j < $nx; ++$j) {
                     $s = 0.0;
                     for ($i = $k; $i < $this->m; ++$i) {
                         $s += $this->QR[$i][$k] * $X[$i][$j];
                     }
                     $s = -$s / $this->QR[$k][$k];
                     for ($i = $k; $i < $this->m; ++$i) {
                         $X[$i][$j] += $s * $this->QR[$i][$k];
                     }
                 }
             }
             // Solve R*X = Y;
             for ($k = $this->n - 1; $k >= 0; --$k) {
                 for ($j = 0; $j < $nx; ++$j) {
                     $X[$k][$j] /= $this->Rdiag[$k];
                 }
                 for ($i = 0; $i < $k; ++$i) {
                     for ($j = 0; $j < $nx; ++$j) {
                         $X[$i][$j] -= $X[$k][$j] * $this->QR[$i][$k];
                     }
                 }
             }
             $X = new PHPExcel_Shared_JAMA_Matrix($X);
             return $X->getMatrix(0, $this->n - 1, 0, $nx);
         } else {
             throw new Exception(self::MatrixRankException);
         }
     } else {
         throw new Exception(PHPExcel_Shared_JAMA_Matrix::MatrixDimensionException);
     }
 }
开发者ID:albatronic,项目名称:hermes,代码行数:46,代码来源:QRDecomposition.php

示例5: checkMatrixDimensions

 /**
  *	checkMatrixDimensions
  *
  *	Is matrix B the same size?
  *	@param Matrix $B Matrix B
  *	@return boolean
  */
 public function checkMatrixDimensions($B = null)
 {
     if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
         if ($this->m == $B->getRowDimension() && $this->n == $B->getColumnDimension()) {
             return true;
         } else {
             throw new PHPExcel_Calculation_Exception(self::MatrixDimensionException);
         }
     } else {
         throw new PHPExcel_Calculation_Exception(self::ArgumentTypeException);
     }
 }
开发者ID:ljhchshm,项目名称:weixin,代码行数:19,代码来源:Matrix.php

示例6: solve

 /**
  * Least squares solution of A*X = B
  * @param Matrix $B A Matrix with as many rows as A and any number of columns.
  * @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
  */
 function solve($B)
 {
     if ($B->getRowDimension() == $this->m) {
         if ($this->isFullRank()) {
             // Copy right hand side
             $nx = $B->getColumnDimension();
             $X = $B->getArrayCopy();
             // Compute Y = transpose(Q)*B
             for ($k = 0; $k < $this->n; $k++) {
                 for ($j = 0; $j < $nx; $j++) {
                     $s = 0.0;
                     for ($i = $k; $i < $this->m; $i++) {
                         $s += $this->QR[$i][$k] * $X[$i][$j];
                     }
                     $s = -$s / $this->QR[$k][$k];
                     for ($i = $k; $i < $this->m; $i++) {
                         $X[$i][$j] += $s * $this->QR[$i][$k];
                     }
                 }
             }
             // Solve R*X = Y;
             for ($k = $this->n - 1; $k >= 0; $k--) {
                 for ($j = 0; $j < $nx; $j++) {
                     $X[$k][$j] /= $this->Rdiag[$k];
                 }
                 for ($i = 0; $i < $k; $i++) {
                     for ($j = 0; $j < $nx; $j++) {
                         $X[$i][$j] -= $X[$k][$j] * $this->QR[$i][$k];
                     }
                 }
             }
             $X = new Matrix($X);
             return $X->getMatrix(0, $this->n - 1, 0, $nx);
         } else {
             trigger_error(MatrixRankException, ERROR);
         }
     } else {
         trigger_error(MatrixDimensionException, ERROR);
     }
 }
开发者ID:TiMoChao,项目名称:xingfu,代码行数:45,代码来源:QRDecomposition.php


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