예제 #1
0
 /**
  * @return Matrix
  * @throws NotSquareException
  */
 public function adjugateMatrix()
 {
     if (!$this->properties->isSquare()) {
         throw new NotSquareException();
     }
     $adjugate = new Matrix($this->matrix->getNumRows(), $this->matrix->getNumCols(), $this->precision);
     $determinant = new Determinant($this->matrix, $this->precision);
     for ($i = 1; $i <= $this->matrix->getNumRows(); $i++) {
         for ($j = 1; $j <= $this->matrix->getNumCols(); $j++) {
             $cofactor = $determinant->cofactor($i, $j);
             $point = new Determinant($cofactor, $this->precision);
             $adjugate->setPoint($j, $i, $point->retrieve());
         }
     }
     return $adjugate;
 }
예제 #2
0
 /**
  * @param $i
  * @param $j
  * @param int|null $precision
  * @return MatrixBase
  */
 public function getAdjunto($i, $j, $precision = null)
 {
     $precision = $this->getPrecision($precision);
     $determinant = new Determinant($this->matrix, $precision);
     return $determinant->cofactor($i, $j);
 }