lu_decom INDEX

LU_DECOM _ _ _ _ _ _ _ _ _ _ _ _ operator

syntax:

lu_decom(<matrix>)

<matrix> :- a matrix containing either numeric entries or imaginary entries with numeric coefficients.

lu_decomperforms LU decomposition on <matrix>, ie: it returns {L,U} where L is a lower diagonal matrix, U an upper diagonal matrix and A = LU.

Caution:

The algorithm used can swap the rows of <matrix> during the calculation. This means that LU does not equal <matrix> but a row equivalent of it. Due to this, lu_decom returns {L,U,vec}. The call convert(meta{matrix,vec)} will return the matrix that has been decomposed, i.e: LU = convert(<matrix>,vec).

examples:



K := mat((1,3,5),(-4,3,7),(8,6,4)); 


       [1   3  5]
       [        ]
  k := [-4  3  7]
       [        ]
       [8   6  4]



on rounded;

lu :=  lu_decom(K); 

  lu := {
         [8    0      0  ]
         [               ]
         [-4  6.0     0  ]
         [               ]
         [1   2.25  1.125]
         ,
         [1  0.75  0.5]
         [            ]
         [0   1    1.5]
         [            ]
         [0   0     1 ]
         ,
         [3 2 3]}



first lu * second lu; 

  [8   6.0  4.0]
  [            ]
  [-4  3.0  7.0]
  [            ]
  [1   3.0  5.0]



convert(K,third lu); 

  P := mat((i+1,i+2,i+3),(4,5,2),(1,i,0));  _ _ _ 
       [i + 1  i + 2  i + 3]
       [                   ]
  p := [  4      5      2  ]
       [                   ]
       [  1      i      0  ]


lu :=  lu_decom(P); 

  lu := {
         [  1        0                      0                ]
         [                                                   ]
         [  4     - 4*i + 5                 0                ]
         [                                                   ]
         [i + 1      3       0.414634146341*i + 2.26829268293]
         ,
         [1  i                 0                ]
         [                                      ]
         [0  1  0.19512195122*i + 0.243902439024]
         [                                      ]
         [0  0                 1                ]
         ,
         [3 2 3]}



first lu * second lu; 

  [  1      i       0   ]
  [                     ]
  [  4      5      2.0  ]
  [                     ]
  [i + 1  i + 2  i + 3.0]



convert(P,third lu); 

  [  1      i      0  ]
  [                   ]
  [  4      5      2  ]
  [                   ]
  [i + 1  i + 2  i + 3]

Related functions: cholesky.