In data gioved? 23 luglio 2009 19:13:28, Raymond Toy ha scritto:
: > Stefano Ferri wrote:
> > I have to apply "limit" to a 42x42 matrix. Altough it is a very simple
> > operation (matrix is simple and also sparse) it takes a lot of time and
> > memory (on an athlon xp-m 2800+).
> >
> > (%i15) limit(K,bk,inf)$
> > Evaluation took 4.4963 seconds (4.5914 elapsed) using 29.406 MB.
> >
> > and this:
> >
> > (%i16) map(lambda([el],limit(el,bk,inf)),K)$
> > Evaluation took 4.5323 seconds (4.6274 elapsed) using 29.417 MB.
>
> That's only about 0.002 sec per element of your 1764 element matrix.
> That doesn't seem so bad to me.
>
> On the other hand, the same matrix when running maxima with cmucl on a
> 1.6 GHz sparc finishes in 2.8 sec.
>
> Are you using clisp? If so, perhaps you will get faster results using
> some other lisp that compiles to native code, such as acl, ccl, cmucl,
> ecl, gcl, lw, or sbcl.
>
> Ray
Yes, I have a package compiled with CLISP. I'm not expert with different kinds
of lisp, I downloaded the package from a Slackware repository... I'll try to
compile Maxima by myself.
As you said, 0.002 sec per element is not bad, but I thought it could be
faster because matrix is sparse. Moreover, limit operations in this example
are very simple.
Maybe limit is not smart enough to understand that elements equal to zero will
remain the same? I don't know about its source code...
Anyway, with a nxn sparse matrix, the order of non-zero elements is n, not
nxn. So is there any way to speed up the process? Considering this, limit
takes about 0.1 seconds per non-zero element, and that's not very good.
Stefano