[Maxima] Conditional inside a block not working
van.nek at arcor.de
Wed Apr 16 02:22:19 CDT 2008
can you please explain, how I can declare $power_mod or power-mod (Lisp level) as
(setf (get '$power_mod 'integer-valued) t)
but this doesn't effect any speed advantage.
Thanks in advance
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,
> Maxima mailing list
> Maxima at math.utexas.edu
More information about the Maxima