Re: IDL inverse matrix problem?? [message #90081 is a reply to message #90078] |
Fri, 23 January 2015 10:56   |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
On Friday, January 23, 2015 at 11:32:44 AM UTC-7, Amin Farhang wrote:
> Dear Chris,
>
> I wonder that why IDL could not handle this, therefore check the inversion with matlab and Python but both of them return correct values. I think it is necessary that IDL developers consider this kind of issues, since I'm seeing that the Astronomer's community are slowly shift to Python or other languages.
>
> Best,
Amin,
I just tried your original matrix, and it didn't work in Python. For example, here's IDL:
IDL> m1 = 9.5d15 + 0.5d18*randomu(1,1,5,/double)
IDL> m2 = -1d0 + 2d0*randomu(2,5,1,/double)
IDL> Am = m1 ## m2
IDL> result = LA_INVERT(Am)
% LA_INVERT: Singular matrix encountered, STATUS=5.
% Execution halted at: $MAIN$
Now let's try the Python numpy.linalg package:
IDL> linalg = Python.Import('numpy.linalg')
IDL> result = linalg.inv(Am)
% PYTHON_CALLMETHOD: Exception: Singular matrix.
% Execution halted at: $MAIN$
Could you please post an example of a small matrix that works in Python but not in IDL?
Thanks!
-Chris
|
|
|