コード例 #1
0
ファイル: Matrix.php プロジェクト: skilla/matrix
 /**
  * @param int $col
  * @param Matrix $base
  * @param int|null $precision
  * @return Matrix $this
  * @throws OutOfRangeException
  */
 public function setCol($col, Matrix $base, $precision = null)
 {
     if ($this->getNumCols() < (int) $col) {
         throw new OutOfRangeException(sprintf('Maximum column %s, actual parameter %s', $this->getNumCols(), $col));
     }
     $precision = $this->getPrecision($precision);
     for ($row = 1; $row <= $this->getNumCols(); $row++) {
         $this->setPoint($row, $col, $base->getPoint($row, 1, $precision), $precision);
     }
     return $this;
 }
コード例 #2
0
ファイル: Properties.php プロジェクト: skilla/matrix
 /**
  * @param Matrix $base
  * @return bool
  */
 public function isEquals(Matrix $base)
 {
     $local = $this->matrix;
     $precision = $this->precision;
     if ($local->getNumCols() !== $base->getNumCols() || $local->getNumRows() !== $base->getNumRows()) {
         return false;
     }
     for ($i = 1; $i <= $local->getNumRows(); $i++) {
         for ($j = 1; $j <= $local->getNumCols(); $j++) {
             if ($local->getPoint($i, $j, $precision) !== $base->getPoint($i, $j, $precision)) {
                 return false;
             }
         }
     }
     return true;
 }