Maxima Lapack is very slow: 7 seconds versus 0.002 seconds in Julia.
Subject: Maxima Lapack is very slow: 7 seconds versus 0.002 seconds in Julia.
From: Manuel Pedrinero rossetil
Date: Sat, 5 May 2012 15:36:54 +0100 (BST)
Recently Raimond Toy asked about what capabilities are lacking in maxima, numeric computations in linear algebra seems to be very slow
?
?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)
In Julia computing eigenvalues of a 50x50 matrix whose entries are random numbers from a normal distribution is about 0.007 seconds.
julia> @time v1,others = eig(randn(50,50));
elapsed time: 0.0070650577545166016 seconds
?The same computation takes 0.002 seconds in Julia. (first make some computation
with eig so that it loads the function in memory).
filewrite("path/file",m);
to convert m to Julia format one can use system and sed
replacing "," => "space" ? "]" by ";" and deleting "["?
the final step is to put parenthesis around the numbers (that are separated by space inside rows and ";" separate rows.
Julia:
@time one,others = eig(m)
?
Maxima version: 5.24.0
Maxima build date: 9:11 2/29/2012
Host type: x86_64-unknown-linux-gnu
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.7
? I know that some efforts like matlisp are trying to improve this situation.