This page is outdated, since starting
with IDL 5.6, most of the LAPACK routines are supported natively.
However, for users of older IDL version the following might still be
useful.
LAPACK for IDL
Unluckily, IDL is not too powerful when dealing with linear algebra problems. Many of the build-in linear algebra routines are implemented in IDL itself, and therefore not very efficient. For processing SAR data, often the a specific operation has to be performed nearly on every single pixel, and this can take very long when using them. Another problem is, that not all of the build-in routines work with complex input.
A nice and efficient solution for this is to use an external linear algebra library, like LAPACK, via the call_external() command. As the human interface to LAPACK can be quite annoying for an IDL user, I wrote a small wrapper in C to simplify the calling process. For example, with this interface you can calculate the eigenvectors and eigenvalues of a complex 3x3 matrix simply by:
dummy=call_external("liblidl.so","c_eigen_all",matrix,3l,e_val,e_vec)
Speed:
The speed improvement is significant. Calculating the eigenvector / eigenvalues of one million random complex 3x3 matrices, I obtain the following results:
436 sec using pure IDL (using lu_complex)
89.9 sec using IDL calling LAPACK
Routines:
Currently only the LAPACK functions are implemented, which were of particular interest for me:
c_eigen_all : eigenvalues and eigenvectors of arbitrary n x n complex matrices
r_eigen_all : eigenvalues and eigenvectors of arbitrary n x n real matrices
c_eigen_hs : eigenvalues and eigenvectors of complex hermitian matrices
r_eigen_hs : eigenvalues and eigenvectors of real symmetric matrices
c_svd : singular value decomposition of arbitrary n x n complex matrices (working but not finished)
r_svd : singular value decomposition of arbitrary n x n real matrices (working but not finished)
Of course, all the other LAPACK routines can also be called, using directly the LAPACK libraries. But of course only using the normal, not simplified way. Maybe I'll add some more routines to the wrapper in the future, but don't thrust me too much on this. I would appreciate very much any contribution.
Installation:
Quite simple. First you need to have the CLAPACK libraries (version 3 or later). This is the C version of LAPACK, in particular you need the files "blas.a", "lapack.a", "libF77.a" and "libI77.a". Please refer to the manual of CLAPACK how to compile them. Unpack the lidl-archive and copy these four files into the resulting lidl-directory. Type "make". This compiles "lidl.so". Then place "lidl.so" at a place where IDL will find it.
Alternatively you can take directly the pre-compiled library (only for linux-i386), available for download. That's all.
Download:
lidl.tgz: source distribution (in C).
liblidl.so: pre-compiled binary library (for linux-i386).
Todo:
The documentation is more than bad. Sorry for that. But you learn a lot until you get working :-)
Include more of the LAPACK routines.
It doesn't work?