當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。