Cholesky decomposition.
Return the Cholesky decomposition. Only lower-triangular is returned.
SciPhp\NdArray
np::linalg()->cholesky(
array|NdArray
$m
)
$m
SciPhp\NdArray Lower-triangular of the Cholesky decomposition.
use SciPhp\NumPhp as np;
$m =
[[ 2, -1, 0 ],
[-1, 2, -1 ],
[ 0, -1, 2 ]];
$lower = np::linalg()->cholesky($m);
$upper = $lower->T;
echo "lower=\n$lower", "upper=\n$upper";
The above example will output:
lower= [[1.4142135623731 0 0 ] [-0.70710678118655 1.2247448713916 0 ] [0 -0.81649658092773 1.1547005383793 ]] upper= [[1.4142135623731 -0.70710678118655 0 ] [0 1.2247448713916 -0.81649658092773] [0 0 1.1547005383793 ]]