Re: LU Decomposition w/o Pivoting
- To: mathgroup at smc.vnet.net
- Subject: [mg91755] Re: LU Decomposition w/o Pivoting
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 7 Sep 2008 05:36:39 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g9t6m5$j89$1@smc.vnet.net>
Benjamin Reedlunn wrote: > I am trying to calculate the signs of the eigenvalues of a bunch of > moderately large matrices (thousand by thousand), which takes a long > time. It has come to my attention that the diagonal terms in a LU > decomposition have the same signs as the eigenvalues. So I'm hoping > that the LU decomposition is faster than calculating the actual > eigenvalues. I tried testing this out using mathematica's built in > function LUDecomposition[] and after a large amount of monkeying > around, I realized the signs of the diagonal terms only match the > eigenvalues if there is no pivoting employed. Unfortunately, I cannot > figure out how to turn off pivoting in LUDecomposition[]. While I am > sure I could write my own LU decomposition function, I'm also sure it > would not be nearly as elegant and computationally efficient as the > built in function. So does anyone know how to turn off > LUDecomposition[] or have optimized code to perform a LU decomposition? FWIW, You might be able to use the second element returned by LUDecomposition for it is a vector specifying the rows used for pivoting. In[1]:= m = Table[N[1/(i + j + 1)], {i, 5}, {j, 5}]; {lu, p, c} = LUDecomposition[m]; lu // Diagonal p Eigenvalues[m] Out[3]= {0.333333, 0.0178571, -0.00111111, -0.0000340136, \ -8.58929*10^-7} Out[4]= {1, 5, 2, 3, 4} Out[5]= {0.83379, 0.0430979, 0.00129982, 0.0000229962, 1.79889*10^-7} HTH, -- Jean-Marc