[Fwd: Re: Singular Matrix Invert]


Sender: Wolfram Ruehaak <geowolf@gmx.de>
Subject: Re: Singular Matrix Invert


Dear Dirk,

maybe you can use something like:

if (A.lu().isNonsingular())

this is how I solved my problem with singular matrices.

Kind regards
Wolfram

hunniger schrieb:
> I receive a RuntimeException, whenever a Matrix is Singular, carrying a 
> text message, that say. "Matrix si singular.". This is Ok. It is very 
> good that it is a runtime exception and not a checked exception, but it 
> would be better if it was a SingularMatrixException, that is derived 
> from RuntimeException
> , because I can catch this exception in a specific way, that is without 
> catching anything else.
> 
> So currently I got
> 
>       try {
>           step();
>       }
>       catch (RuntimeException r) {
>           System.out.println(error());
>           if (r.getMessage().equals("Matrix is singular.")) {
>               for (Variable v:variables) {
>                   v.value+=0.001*Math.random();
>               }
>           }
>           else {
>               throw r;
>           }
>       }
> 
> 
> but I would like to have
> 
> 
>       try {
>           step();
>       }
>       catch (SingularMatrixException r) {
>           System.out.println(error());
>           for (Variable v:variables) {
>                v.value+=0.001*Math.random();
>           }
>       }
> 
> 
> because not you can change the string "Matrix is singular." to anything 
> you like and I don't need to change my code.
> 
> Yours Dirk
> 
> 
> 
> 







Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov