Alternative bernoulli(const numeric &)

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Sat Jan 19 16:05:27 CET 2002


Hi,

On Sat, 19 Jan 2002, Markus Nullmeier wrote:
> > Sure, they are notoriously untractable.  But was there really such a
> > limit in the old code?  I was under the impression that I once had it
> > compute B_{30000} but I might be wrong...
> 
> Oh, sorry about this confusion. I overlooked some points while reading
> the 1.0.3 code. I rather should have said that the (long) value of (m*n)
> overflows 2^32-1 for B_{32768}. I'm guessing that this should impact the
> calculated values.

Ah, okay.

> > I do not think the difference in times will be worth the effort, but I
> > haven't tried.  Making it safe such that somebody who wants to see it
> > break down would have to let it run for a week or so is more important.
> 
> Make-safe patch to follow ... :)

While you are at it, could you also make sure to call resize() on results
with an appropiate argument before entering the loop in wich the
push_back() is being done?  This is, because push_back() is likely to
trigger a couple of reallocations in there and this is quite expensive for
any vectors, since they are contiguous in their memory layout.  (The old
code should have already done that.)

Regards
     -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>





More information about the GiNaC-devel mailing list