71        if ($A instanceof 
Matrix) {
 
   73            $this->LU = $A->getArray();
 
   74            $this->m = $A->getRowDimension();
 
   75            $this->n = $A->getColumnDimension();
 
   80            $LUrowi = $LUcolj = [];
 
   86                    $LUcolj[
$i] = &$this->LU[
$i][$j];
 
   90                    $LUrowi = $this->LU[
$i];
 
   94                    for ($k = 0; $k < $kmax; ++$k) {
 
   95                        $s += $LUrowi[$k] * $LUcolj[$k];
 
   97                    $LUrowi[$j] = $LUcolj[
$i] -= 
$s;
 
  102                    if (abs($LUcolj[
$i]) > abs($LUcolj[$p])) {
 
  108                        $t = $this->LU[$p][$k];
 
  109                        $this->LU[$p][$k] = $this->LU[$j][$k];
 
  110                        $this->LU[$j][$k] = 
$t;
 
  113                    $this->piv[$p] = $this->piv[$j];
 
  115                    $this->pivsign = $this->pivsign * -1;
 
  118                if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
 
  120                        $this->LU[
$i][$j] /= $this->LU[$j][$j];
 
  142                    $L[
$i][$j] = $this->LU[
$i][$j];
 
  143                } elseif (
$i == $j) {
 
  167                    $U[
$i][$j] = $this->LU[
$i][$j];
 
  211            if ($this->LU[$j][$j] == 0) {
 
  228        if ($this->m == $this->n) {
 
  231                $d *= $this->LU[$j][$j];
 
  259                        for ($j = 0; $j < $nx; ++$j) {
 
  260                            $X->A[
$i][$j] -= 
$X->A[$k][$j] * $this->LU[
$i][$k];
 
  265                for ($k = $this->n - 1; $k >= 0; --$k) {
 
  266                    for ($j = 0; $j < $nx; ++$j) {
 
  267                        $X->A[$k][$j] /= $this->LU[$k][$k];
 
  269                    for (
$i = 0; 
$i < $k; ++
$i) {
 
  270                        for ($j = 0; $j < $nx; ++$j) {
 
  271                            $X->A[
$i][$j] -= 
$X->A[$k][$j] * $this->LU[
$i][$k];
 
  279            throw new CalculationException(self::MATRIX_SINGULAR_EXCEPTION);
 
  282        throw new CalculationException(self::MATRIX_SQUARE_EXCEPTION);
 
An exception for terminatinating execution or to throw for unit testing.
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L,...
__construct($A)
LU Decomposition constructor.
getU()
Get upper triangular factor.
solve(Matrix $B)
Solve A*X = B.
const MATRIX_SINGULAR_EXCEPTION
isNonsingular()
Is the matrix nonsingular?
getDoublePivot()
Alias for getPivot.
const MATRIX_SQUARE_EXCEPTION
getL()
Get lower triangular factor.
getPivot()
Return pivot permutation vector.
getMatrix(... $args)
getMatrix.
const MATRIX_DIMENSION_EXCEPTION
getRowDimension()
getRowDimension.
const ARGUMENT_TYPE_EXCEPTION
getColumnDimension()
getColumnDimension.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Class for the creating "special" Matrices.