Stavros,
can you please explain, how I can declare $power_mod or power-mod (Lisp level) as
integer-valued ?
I tried
(setf (get '$power_mod 'integer-valued) t)
but this doesn't effect any speed advantage.
Thanks in advance
Volker
Am 13 Apr 2008 um 13:02 hat Stavros Macrakis geschrieben:
> On Sun, Apr 13, 2008 at 12:43 PM, Bill Wood <william.wood3 at comcast.net> wrote:
> > There must be a lot of overhead in the maxima-to-lisp translations of
> > functions. I compiled foo and then ran "foo(5000000)" -- it took 2
> > minutes wall time. My lisp version (CMUCL) using my own implementation
> > of power_mod took 15 sec. after compilation.
>
> Partly there is indeed some extra overhead.. But partly it's simply
> because the translator tries to respect Maxima semantics, which means
> that the general case of symbolic values must be handled, f(x) where f
> is undefined returns f(x) not an error, etc. In your example, the
> translator has no way of knowing that "bound" is an integer value, for
> example. And power_mod is not declared internally as an
> integer-valued function (this is a bug).
>
> Try declaring your variables and functions as integer-valued and see
> how much that helps:
>
> foo(bound) := block([m],
> modedeclare([m,bound,function(power_mod)],integer), ...
>
> Let us know,
>
> -s
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima