michf | 8 Jul 2012 18:36
Picon
Picon

missing lapack functions in scipy.linalg.flapack

I'm trying to access a few lapack functions that don't seem to be  
available directly in scipy as far as I can tell. Specifically I need  
at the moment ?trsyl (solve triagonal sylvester equation) and the  
various subfunctions for computing eigenvectors (the whole stack used  
behind ?geev)

I'm currently using the 64bit windows distribution from enthought  
(academic version).

Any ideas?

Thanks
Ralf Gommers | 8 Jul 2012 19:52
Gravatar

Re: missing lapack functions in scipy.linalg.flapack



On Sun, Jul 8, 2012 at 6:36 PM, <michf <at> post.tau.ac.il> wrote:
I'm trying to access a few lapack functions that don't seem to be
available directly in scipy as far as I can tell.

They are. trsyl was added recently (for 0.11), geev should be in older versions too.

In [6]: linalg.flapack.dtrsyl
Out[6]: <fortran object>

In [7]: linalg.flapack.dgeev
Out[7]: <fortran object>

In [8]: linalg.solve_sylvester
Out[8]: <function scipy.linalg._solvers.solve_sylvester>

Ralf

 
Specifically I need
at the moment ?trsyl (solve triagonal sylvester equation) and the
various subfunctions for computing eigenvectors (the whole stack used
behind ?geev)

I'm currently using the 64bit windows distribution from enthought
(academic version).

Any ideas?

Thanks

_______________________________________________
SciPy-User mailing list
SciPy-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
SciPy-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
michf | 8 Jul 2012 21:43
Picon
Picon

Re: missing lapack functions in scipy.linalg.flapack

It seems that ensight is using scipy 0.10.1 and not 0.11, and a  
version of 0.11 for 64 bit windows doesn't seem to be available.

Under 0.10 solve_sylvester seems to be missing, and trsyl as well.

As for eigenvalues, I was actually looking for trevc and hsein.

It seems that wrappers for these are not implemented, I'm looking on  
how to do it myself, although I'm not sure. There is some information  
regarding calling mkl directly using ctypes, I'll see if I can get  
that to work.

Thanks.

Quoting Ralf Gommers <ralf.gommers <at> googlemail.com>:

> On Sun, Jul 8, 2012 at 6:36 PM, <michf <at> post.tau.ac.il> wrote:
>
>> I'm trying to access a few lapack functions that don't seem to be
>> available directly in scipy as far as I can tell.
>
>
> They are. trsyl was added recently (for 0.11), geev should be in older
> versions too.
>
> In [6]: linalg.flapack.dtrsyl
> Out[6]: <fortran object>
>
> In [7]: linalg.flapack.dgeev
> Out[7]: <fortran object>
>
> In [8]: linalg.solve_sylvester
> Out[8]: <function scipy.linalg._solvers.solve_sylvester>
>
> Ralf
>
>
>
>> Specifically I need
>> at the moment ?trsyl (solve triagonal sylvester equation) and the
>> various subfunctions for computing eigenvectors (the whole stack used
>> behind ?geev)
>>
>> I'm currently using the 64bit windows distribution from enthought
>> (academic version).
>>
>> Any ideas?
>>
>> Thanks
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User <at> scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
Ralf Gommers | 10 Jul 2012 14:00
Gravatar

Re: missing lapack functions in scipy.linalg.flapack



On Sun, Jul 8, 2012 at 9:43 PM, <michf <at> post.tau.ac.il> wrote:
It seems that ensight is using scipy 0.10.1 and not 0.11, and a
version of 0.11 for 64 bit windows doesn't seem to be available.

Under 0.10 solve_sylvester seems to be missing, and trsyl as well.

As for eigenvalues, I was actually looking for trevc and hsein.

It seems that wrappers for these are not implemented, I'm looking on
how to do it myself, although I'm not sure. There is some information
regarding calling mkl directly using ctypes, I'll see if I can get
that to work.

If you want to wrap then in a way that's reusable in scipy, then using f2py would be the way to go. For examples, see scipy/linalg/flapack.pyf.src

Ralf



Thanks.

Quoting Ralf Gommers <ralf.gommers <at> googlemail.com>:

> On Sun, Jul 8, 2012 at 6:36 PM, <michf <at> post.tau.ac.il> wrote:
>
>> I'm trying to access a few lapack functions that don't seem to be
>> available directly in scipy as far as I can tell.
>
>
> They are. trsyl was added recently (for 0.11), geev should be in older
> versions too.
>
> In [6]: linalg.flapack.dtrsyl
> Out[6]: <fortran object>
>
> In [7]: linalg.flapack.dgeev
> Out[7]: <fortran object>
>
> In [8]: linalg.solve_sylvester
> Out[8]: <function scipy.linalg._solvers.solve_sylvester>
>
> Ralf
>
>
>
>> Specifically I need
>> at the moment ?trsyl (solve triagonal sylvester equation) and the
>> various subfunctions for computing eigenvectors (the whole stack used
>> behind ?geev)
>>
>> I'm currently using the 64bit windows distribution from enthought
>> (academic version).
>>
>> Any ideas?
>>
>> Thanks
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User <at> scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>



_______________________________________________
SciPy-User mailing list
SciPy-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
SciPy-User <at> scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
Sturla Molden | 12 Jul 2012 12:57
Picon
Gravatar

Re: missing lapack functions in scipy.linalg.flapack

On 08.07.2012 18:36, michf <at> post.tau.ac.il wrote:
> I'm trying to access a few lapack functions that don't seem to be
> available directly in scipy as far as I can tell. Specifically I need
> at the moment ?trsyl (solve triagonal sylvester equation) and the
> various subfunctions for computing eigenvectors (the whole stack used
> behind ?geev)
>
> I'm currently using the 64bit windows distribution from enthought
> (academic version).
>
> Any ideas?

The easiest way to get a LAPACK function not in SciPy is to use LAPACKE 
(the new C interface) from Cython or ctypes.

Enthought comes with Intel MKL (at least on Windows) which already has a 
LAPACKE interface:

from ctypes import CDLL, c_char, c_int
import numpy as np
from numpy.ctypeslib import ndpointer
LAPACK_ROW_MAJOR = 101
LAPACK_COL_MAJOR = 102
intel_mkl = CDLL('mk2_rt.dll')
LAPACKE_dtrsyl = intel_mkl.LAPACKE_dtrsyl
array_t = ndpointer(dtype=np.float64, ndim=2)
LAPACKE_dtrsyl.restype = c_int
LAPACKE_dtrsyl.argtypes = [c_int, c_char, c_char, c_int, c_int, c_int,
     _array_t, c_int, _array_t, c_int, _array_t, c_int, c_double]

And then you can call the function like this:

info = LAPACKE_dtrsyl(LAPACK_ROW_MAJOR, # or LAPACK_COL_MAJOR
     'N', 'N', ISGN, M, N, A, LDA, B, LDB, C, LDC, SCALE)

Sturla

Gmane