Discussion:
[SciPy-user] AttributeError: 'scipy.linalg' module has no attribute '_cast'
Nils Wagner
2002-03-06 17:48:26 UTC
Permalink
Hi,

I tried to import linalg from scipy

Python 2.1.2 (#1, Feb 25 2002, 18:04:21)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "copyright", "credits" or "license" for more information.
from scipy import *
from scipy.linalg import *
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'scipy.linalg' module has no attribute '_cast'
from scipy.linalg import expm
Any idea ?

Nils

Moreover, the matrix functions do not work properly.
a = 1.*identity(2)
print sinm(a)
array_from_pyobj:intent(inout) array must be contiguous and with a
proper type and size.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 777, in sinm
return toreal(-0.5j*(expm(1j*A) - expm(-1j*A)))
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 735, in expm
F = solve(D,N)
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 122, in solve
results = lapack_routine(a, bt)
clapack.error: failed in converting 2nd argument `b' of clapack.zgesv to
C/Fortran array
Travis Oliphant
2002-03-06 16:56:31 UTC
Permalink
Post by Nils Wagner
Any idea ?
Nils
Moreover, the matrix functions do not work properly.
a = 1.*identity(2)
print sinm(a)
array_from_pyobj:intent(inout) array must be contiguous and with a
proper type and size.
File "<stdin>", line 1, in ?
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 777, in sinm
return toreal(-0.5j*(expm(1j*A) - expm(-1j*A)))
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 735, in expm
F = solve(D,N)
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 122, in solve
results = lapack_routine(a, bt)
clapack.error: failed in converting 2nd argument `b' of clapack.zgesv to
C/Fortran array
Unfortunately, I think that the changes to f2py have broken the linalg
interfaces. Pearu is working on linalg2 which will replace linalg.

-Travis
Nils Wagner
2002-03-07 13:36:30 UTC
Permalink
Post by Travis Oliphant
Post by Nils Wagner
Any idea ?
Nils
Moreover, the matrix functions do not work properly.
a = 1.*identity(2)
print sinm(a)
array_from_pyobj:intent(inout) array must be contiguous and with a
proper type and size.
File "<stdin>", line 1, in ?
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 777, in sinm
return toreal(-0.5j*(expm(1j*A) - expm(-1j*A)))
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 735, in expm
F = solve(D,N)
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 122, in solve
results = lapack_routine(a, bt)
clapack.error: failed in converting 2nd argument `b' of clapack.zgesv to
C/Fortran array
Unfortunately, I think that the changes to f2py have broken the linalg
interfaces. Pearu is working on linalg2 which will replace linalg.
-Travis
_______________________________________________
SciPy-user mailing list
http://www.scipy.net/mailman/listinfo/scipy-user
Travis,

Finally, I have used the latest CVS. It turned out all right.

BTW, how can I invoke funm for the computation of an arbitrary matrix
function ?
A small example would be very helpful.
Post by Travis Oliphant
Post by Nils Wagner
help(funm)
funm(A, func, disp=1)

Matrix function for arbitrary callable object func.


Moreover I agree to submit algorithms for both sqrtm and logm.
How can I contribute ?

Nils
Nils Wagner
2002-03-07 13:36:30 UTC
Permalink
Post by Travis Oliphant
Post by Nils Wagner
Any idea ?
Nils
Moreover, the matrix functions do not work properly.
a = 1.*identity(2)
print sinm(a)
array_from_pyobj:intent(inout) array must be contiguous and with a
proper type and size.
File "<stdin>", line 1, in ?
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 777, in sinm
return toreal(-0.5j*(expm(1j*A) - expm(-1j*A)))
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 735, in expm
F = solve(D,N)
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 122, in solve
results = lapack_routine(a, bt)
clapack.error: failed in converting 2nd argument `b' of clapack.zgesv to
C/Fortran array
Unfortunately, I think that the changes to f2py have broken the linalg
interfaces. Pearu is working on linalg2 which will replace linalg.
-Travis
_______________________________________________
SciPy-user mailing list
http://www.scipy.net/mailman/listinfo/scipy-user
Travis,

Finally, I have used the latest CVS. It turned out all right.

BTW, how can I invoke funm for the computation of an arbitrary matrix
function ?
A small example would be very helpful.
Post by Travis Oliphant
Post by Nils Wagner
help(funm)
funm(A, func, disp=1)

Matrix function for arbitrary callable object func.


Moreover I agree to submit algorithms for both sqrtm and logm.
How can I contribute ?

Nils
Travis Oliphant
2002-03-06 16:56:31 UTC
Permalink
Post by Nils Wagner
Any idea ?
Nils
Moreover, the matrix functions do not work properly.
a = 1.*identity(2)
print sinm(a)
array_from_pyobj:intent(inout) array must be contiguous and with a
proper type and size.
File "<stdin>", line 1, in ?
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 777, in sinm
return toreal(-0.5j*(expm(1j*A) - expm(-1j*A)))
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 735, in expm
F = solve(D,N)
File
"/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
line 122, in solve
results = lapack_routine(a, bt)
clapack.error: failed in converting 2nd argument `b' of clapack.zgesv to
C/Fortran array
Unfortunately, I think that the changes to f2py have broken the linalg
interfaces. Pearu is working on linalg2 which will replace linalg.

-Travis
Travis Oliphant
2002-03-07 15:27:16 UTC
Permalink
Post by Nils Wagner
Travis,
Finally, I have used the latest CVS. It turned out all right.
BTW, how can I invoke funm for the computation of an arbitrary matrix
function ?
A small example would be very helpful.
help(funm)
funm(A, func, disp=1)
Matrix function for arbitrary callable object func.
func is just an arbitrary callable object that will be called on the schur
values. The only restriction is that it needs to take a vector of
arguments and return the function evaluated elementwise over that vector.

(See special.genera_function) if you want to "vectorize" a function.

So, for example

from scipy import *

linalg.funm(A, sqrt)

should compute the matrix square-root (the algorithm is general purpose
and can fail). The disp flag controls whether or not a warning is printed
if something doesn't seem right.
Post by Nils Wagner
Moreover I agree to submit algorithms for both sqrtm and logm.
How can I contribute ?
Send them to me.

It would be preferrable if there is a test sent along with the algorithm.

-Travis
Travis Oliphant
2002-03-07 15:27:16 UTC
Permalink
Post by Nils Wagner
Travis,
Finally, I have used the latest CVS. It turned out all right.
BTW, how can I invoke funm for the computation of an arbitrary matrix
function ?
A small example would be very helpful.
help(funm)
funm(A, func, disp=1)
Matrix function for arbitrary callable object func.
func is just an arbitrary callable object that will be called on the schur
values. The only restriction is that it needs to take a vector of
arguments and return the function evaluated elementwise over that vector.

(See special.genera_function) if you want to "vectorize" a function.

So, for example

from scipy import *

linalg.funm(A, sqrt)

should compute the matrix square-root (the algorithm is general purpose
and can fail). The disp flag controls whether or not a warning is printed
if something doesn't seem right.
Post by Nils Wagner
Moreover I agree to submit algorithms for both sqrtm and logm.
How can I contribute ?
Send them to me.

It would be preferrable if there is a test sent along with the algorithm.

-Travis

Loading...