none
"The system cannot be solved: the matrix is singular or close to singular." in LU decomposition

    Pergunta

  • Hello,

    I have a problem using sho LU decompusition from C# code. 

    When I do 

    var solver = new LU(leftPart);
    var x = solver.Solve(rightPart);

    the exception "The system cannot be solved: the matrix is singular or close to singular." is thrown in the Solve method invokation. The leftPart is invertible. The determenant is 22142.9

    When I do 

    solver.PermMatrix.Inv()*solver.L*solver.U 

    I get the leftPart. Thats why I can say the decomposition itself works correctly. But the invokation of Solve method doesn't work.

    When I do manual computaion instead of calling Solve method like

    var x = solver.U.Inv()*solver.L.Inv()*solver.PermMatrix*rightPart;

    I get the result and no exception is thrown. The solution exists.

    So please tell me what is is problem? Is this a bug? Or I use LU object incorrectly?

    the leftPart is

    [ 1,0000            1,0000          1,0000          0,0000    0,0000    0,0000
      51,9300           53,4300         31,7800         0,0000    0,0000    0,0000
     -10,2500           -6,2500         35,2200         0,0000    0,0000    0,0000
      153336928,2251    137718739,3027  0,0000          35,2200   31,7800   1,0000
      577859,9901       0,0000          137718739,3027  -6,2500   53,4300   1,0000
      0,0000            577859,990      153336928,2251  -10,2500  51,9300   1,0000]

    the right part is 

      [ 0,0000
      0,0000
      0,0000
      19,5129
      9,8517
      10,6909]

    Thanks, Dmitry.

    terça-feira, 14 de fevereiro de 2012 11:33