simply getDeterminant method

This commit is contained in:
Arkadiusz Kondas 2016-04-30 23:54:05 +02:00
parent 2952557028
commit 650e7dd20d

View File

@ -126,6 +126,16 @@ class Matrix
throw MatrixException::notSquareMatrix();
}
return $this->determinant = $this->calculateDeterminant();
}
/**
* @return float|int
*
* @throws MatrixException
*/
private function calculateDeterminant()
{
$determinant = 0;
if ($this->rows == 1 && $this->columns == 1) {
$determinant = $this->matrix[0][0];
@ -141,7 +151,7 @@ class Matrix
}
}
return $this->determinant = $determinant;
return $determinant;
}
/**