Maxima Lapack is very slow: 7 seconds versus 0.002 seconds in Julia.



On 5/5/12 7:36 AM, Manuel Pedrinero rossetil wrote:
> Recently Raimond Toy asked about what capabilities are lacking in
> maxima, numeric computations in linear algebra seems to be very slow
>
That's not a lack of capability, but rather a quality of implementation
issue.
>  
>  This is an example in gcl using lapack
>
> (%i1) load(lapack);
> /share/lapack/binary-gcl/dgemm.o
> (%o1)          /usr/share/maxima/5.24.0/share/lapack/lapack.mac
> (%i2) h[i,j]:= 1/(i+j);
>                                            1
> (%o2)                           h     := -----
>                                  i, j    i + j
> (%i3) m : genmatrix(h,50,50)$
>
> (%i4) showtime : true;
> Evaluation took 0.0000 seconds (0.0000 elapsed)
> (%o4)                                true
> (%i5) [one,two,three] : dgeev(m)$
> Evaluation took 7.3200 seconds (7.4000 elapsed)
>

What kind of machine did you run this on?  On my machine, this took .04
sec (using cmucl).

In any case, this could be faster but it is not because lapack is a
(machine) translation from the original Fortran to Lisp.  Maxima does
not have an ffi so this is the only reasonably simple and portable
approach available. [1]

If all you care about is computing a huge number of eigenvalues/vectors,
then maxima is the wrong tool.  Use a different tool.

Ray

[1] Matlisp has recently been updated to use cffi, suddenly making
matlisp basically available on any lisp supported by cffi, which
includes all lisps supported by maxima, except gcl.  But based on my
experience with building lapack in matlisp, this is not that easy to do
because there are many fortran compilers out there and that all do
different things which the ffi needs to take into account. While adding
support for cffi to maxima is straighforward making it useful with the
existing code that we have is not as easy, but it's not rocket science
either.