示例#1
0
 public function inverse()
 {
     $determinant = new Determinant($this->matrix);
     $factor = $determinant->retrieve();
     if ($factor === $this->valueZero) {
         throw new NotInverseException();
     }
     $factor = 1 / $factor;
     $transposed = $this->transposed();
     $operations = new Operations($transposed, $this->precision);
     $adjugate = $operations->adjugateMatrix();
     $operations = new Operations($adjugate, $this->precision);
     return $operations->multiplicationScalar($factor);
 }
示例#2
0
 /**
  * @return string
  * @throws OperationNotAllowedException
  */
 public function forOrderN()
 {
     if ($this->matrix->getNumRows() <= 3) {
         throw new OperationNotAllowedException('determinantOrderN only allowed on 4x4 or greater matrix');
     }
     $this->gaussReduction();
     $determinant = new Determinant($this->cofactor(1, 1));
     return bcmul($this->matrix->getPoint(1, 1), $determinant->retrieve(), $this->precision);
 }
示例#3
0
 public function determinant($precision = null)
 {
     $precision = $this->getPrecision($precision);
     $determinant = new Determinant($this->matrix, $precision);
     return $determinant->retrieve();
 }