Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

[MUG] Re: Optimize tryhard

2 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Maple User Group

ungelesen,
29.11.2002, 09:37:4129.11.02
an

>> From: Maple User Group <mapl...@scg.math.uwaterloo.ca>

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

From: Gaston Gonnet <gon...@inf.ethz.ch>
Date: Wed, 27 Nov 2002 17:53:49 +0100 (MET)
To: maple...@scg.math.uwaterloo.ca
Subject: Optimize tryhard

Yes, I have some information about tryhard, I have coded it some
time ago. I coded it because I was doing molecular dynamics at
the time, and that requires hundreds of hours of computation, hence
optimization time is not very relevant, but quality of the optimization
is.

optimize/tryhard is unique to that piece of code, all the rest of
codegen or Maple do not utilize it.

I never had the time to write a paper about it.... apologies....

Is there anything in particular you would like to know about it?

Best wishes, Gaston Gonnet.


-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-

Date: Wed, 27 Nov 2002 18:11:28 -0500 (EST)
From: Carl Devore <dev...@math.udel.edu>
To: <maple...@scg.math.uwaterloo.ca>
Subject: Optimize tryhard

On Tue, 26 Nov 2002, Moore, Brian wrote:
> I'm looking for information on the algorithm used in the optimize with
> tryhard option in the codegen package.

It is all in procedures `codegen/optimize/tryhard/frontend` and its
subsidiaries. Just read the procedures with showstat.

> Actually, the optimize tryhard seems to generate very efficient code,
> but it takes a long time to generate the code.

Yeah, it is pretty good. With a tiny bit of tweaking, it can also be used
as an expression simplifier. For lengthy algebraic number expressions, it
often gives significantly more simplification than the other
simplification commands. Here is the tweaking:

Tryhard:= proc(expr)
local _E;
subs(
pow= `^`
,codegen[optimize](subs(_E= expr, ()-> _E), tryhard)
)()
end proc:

Show that is does something potentially useful:

_EnvExplicit:= true:
p:= randpoly([x,y], degree= 4, dense);
root1:= solve(p, y)[1];
# Root is 11 screens long on my computer
simplify(root1);
# Still 11 screens long
r:= Tryhard(root1);
# 2 1/2 screens long, and it only took twice as long as the simplify.

The actual procedure returned by codegen[optimize] in this case is only
1/3 of a screen long. So, looking at that procedure can give a deeper
understanding of the internal structure of root1 than can be obtained by
looking at the 2 1/2 screens.

Test validity:

simplify(eval(p, y= r));
0

So people who collect such things can file that in their Maple trick bag.

0 neue Nachrichten