[GiNaC-devel] Performance Problem with subs
Frieder Kalisch
kalisch at tphys.uni-heidelberg.de
Mon Dec 20 12:37:05 CET 2004
Hello,
there is something severely wrong performance wise with subs and or eval in
ginac. Suppose I want to expand 1/(a+sqrt(b*b+x*x)) in a power series in x
around x==1 and then substitute numerical values (floating point) for a, b
and x.
Doing this straight forwardly with series(), series_to_poly() and subs()
[program 1] needs 0.01 seconds for series and series_to_poly and 15.99
seconds for subs. However, if I define my own functions f1(x)->1/x and f2
(x)->sqrt(x) using DECLARE_FUNCTION_1P and REGISTER_FUNCTION with the only
function options being evalf_func and derivative_func [program 2], it takes
0.09 seconds to do series() and series_to_poly() and 0.02 seconds for the
subs()!
I suspect, that ginac somehow tries to restructure the expression on a large
scale, since if I insert an expand() in the first case between
series_to_poly() and subs() [program 3], it takes 15.99 seconds to do the
expand() and only 0.12 seconds for the subs().
I have used ginac-version 1.2.4-1 on debian sarge. Attached to this Email You
find the source code for my program. Please ask if You have any questions.
Regards
Frieder Kalisch
--
Frieder Kalisch Institut für theoretische Physik
kalisch at tphys.uni-heidelberg.de Philosophenweg 19
+49-6221-549-433 D-69120 Heidelberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ginactest.cc
Type: text/x-c++src
Size: 1429 bytes
Desc: not available
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20041220/afa37bfc/ginactest.bin
More information about the GiNaC-devel
mailing list