comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: failed matrix inversion returns input-- interesting

Re: failed matrix inversion returns input-- interesting
type: item
description: Ed Hyer wrote: > Can someone explain this behavior? > IDL> testm=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] > IDL> testmi=invert(testm,status) > IDL> print,status; 0=success, 1=fail, 2=pivot used > 1 > IDL> print,testmi > 0.00000 0.00000 0.00000 0.00000 > 0.00000 1.00000 0.00000 0.00000 > 0.00000 0.00000 1.00000 0.00000 > 0.00000 0.00000 0.00000 1.00000 > > Is there any reason in creation why IDL simply copies the input into > the output if it cannot do the inversion? That seems, well, malevolent, > unless I'm missing something. Well, what do you suggest is better? Marc
creator: marc schellens[1]
date: 2006-07-14T07:09:21-00:00

Re: failed matrix inversion returns input-- interesting
type: item
description: Ed Hyer wrote: > Can someone explain this behavior? > IDL> testm=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] > IDL> testmi=invert(testm,status) > IDL> print,status; 0=success, 1=fail, 2=pivot used > 1 > IDL> print,testmi > 0.00000 0.00000 0.00000 0.00000 > 0.00000 1.00000 0.00000 0.00000 > 0.00000 0.00000 1.00000 0.00000 > 0.00000 0.00000 0.00000 1.00000 > > Is there any reason in creation why IDL simply copies the input into > the output if it cannot do the inversion? That seems, well, malevolent, > unless I'm missing something. > I would not call this behavior malevolent. For a singular matrix the inversion is invalid. So the result is meaningless anyway and it does not matter whether IDL returns a fictious array or the input matrix. When solving linear equations it is always recommended to check the condition number of the matrix using cond and use singular value decomposition in case of an ill-behaved matrix. regards, B.St.
creator: Bringfried Stecklum
date: 2006-07-14T07:14:20-00:00

Re: failed matrix inversion returns input-- interesting
type: item
description: In article <1152860961.931059.317520@35g2000cwc.googlegroups.com>, "m_schellens@hotmail.com" <m_schellens@hotmail.com> writes: > > Ed Hyer wrote: >> Can someone explain this behavior? >> IDL> testm=[[0,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] >> IDL> testmi=invert(testm,status) >> IDL> print,status; 0=success, 1=fail, 2=pivot used >> 1 >> IDL> print,testmi >> 0.00000 0.00000 0.00000 0.00000 >> 0.00000 1.00000 0.00000 0.00000 >> 0.00000 0.00000 1.00000 0.00000 >> 0.00000 0.00000 0.00000 1.00000 >> >> Is there any reason in creation why IDL simply copies the input into >> the output if it cannot do the inversion? That seems, well, malevolent, >> unless I'm missing something. > > Well, what do you suggest is better? > Well, nearly anything would be better. I've a routine, called SVD_INVERT, which returns a regular inverse when one exists, else it returns and inverse in the "SVD sense". Would the IDL routine have been doing this, that would be fine (though it should've been documented). But, it is not doing this either. So IMO, it would've been preferable to return an array of NANs in such case. Mati Meron | "When you argue with a fool, meron@cars.uchicago.edu | chances are he is doing just the same"
creator: mmeron
date: 2006-07-14T07:30:57-00:00

Re: failed matrix inversion returns input-- interesting
type: item
description: > Is there any reason in creation why IDL simply copies the input into > the output if it cannot do the inversion? That seems, well, malevolent, > unless I'm missing something. One reason you might want this behaviour is to preserve the original array, in cases where the code overwrites the inverse IDL> testm = invert(testm, status) IDL> if status EQ 1 then print,'Singular Matrix ', testm If INVERT returned, say, NaN values or an undefined variable (the only reasonable alternatives I think), then you would have lost the original array Incidentally, the LAPACK (LU Decomposition) invert routine LA_INVERT in IDL has the same behavior. ---Wayne
creator: news.verizon.net
date: 2006-07-14T12:23:54-00:00