mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-26 06:46:45 +00:00
simply getDeterminant method
This commit is contained in:
parent
2952557028
commit
650e7dd20d
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user