mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-21 13:58:42 +00:00
Remove cholesky from Matrix, is standalone
This commit is contained in:
parent
ce60a1c68d
commit
99d4d80d19
|
|
@ -802,32 +802,4 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
unset($this->matrix[$row][$offset - $row * $this->n]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decompose matrix using cholesky algorithm.
|
||||
*
|
||||
* @return Matrix
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function decompositionCholesky() : Matrix
|
||||
{
|
||||
$newMatrix = new Matrix($this->n, $this->n);
|
||||
$newMatrixArr = $newMatrix->getMatrix();
|
||||
|
||||
for ($i = 0; $i < $this->n; $i++) {
|
||||
for ($j = 0; $j < $i + 1; $j++) {
|
||||
$temp = 0;
|
||||
|
||||
for ($c = 0; $c < $j; $c++) {
|
||||
$temp += $newMatrixArr[$i][$c] * $newMatrixArr[$j][$c];
|
||||
}
|
||||
|
||||
$newMatrixArr[$i][$j] = ($i == $j) ? sqrt($this->matrix[$i][$i] - $temp) : (1 / $newMatrixArr[$j][$j] * ($this->matrix[$i][$j] - $temp));
|
||||
}
|
||||
}
|
||||
|
||||
$newMatrix->setMatrix($newMatrixArr);
|
||||
|
||||
return $newMatrix;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user