Memory issue
Craig Helfgott
chelfgott at gmail.com
Fri Dec 24 02:12:24 CET 2010
As it turns out, it was not a memory leak issue. Instead, the issue was
that my complex gamma function algorithm was a memory-hog when the imaginary
part of the argument got large. I'm still trying to figure out why.
I'm not fond of Spouge's approximation -- too many sqrts and powers of e for
me. I had been using
Gamma(z) ~= N^z e^{-N} / z \sum_{j=0}^{4N} N^j / (z+1)...(z+j) + E(N,z)
for 1 <= Re(z) <= 2, with E(N,z) < 2^{-N}. But this requires 10 times as
many terms as Spouge's approximation (and like I said my implementation has
some problems).
Does anyone have a gamma approximation/algorithm that they prefer, and why?
On Wed, Dec 22, 2010 at 2:30 PM, Gabriel Risterucci <
gabriel.risterucci at univmed.fr> wrote:
> Hi,
>
> You don't need to resize an array for it to be a VLA; as long as the
> compiler can't tell the size of the array at build time (when the size
> depend on a variable), it's a VLA.
> Although they don't seem to be the source of your problem, you might run
> into portability issue using them, amongst other things.
>
> --
> Gabriel Risterucci
> http://cleyfaye.net
>
>
>
> 2010/12/22 Craig Helfgott <chelfgott at gmail.com>
>
>> Actually, I don't have VLAs in my exp function. In that function I first
>> figure out the initial value of LgNTerms, then declare my arrays to be
>> length (that+2). I never resize my arrays, and that is the first time
>> they
>> are declared. But I'll try the constructor/destructor trick.
>>
>> On Wed, Dec 22, 2010 at 4:15 AM, Marc Glisse <marc.glisse at inria.fr>
>> wrote:
>>
>> > On Tue, 21 Dec 2010, Craig Helfgott wrote:
>> >
>> > Okay, checked up on VLAs. These are not VLAs.
>> >>
>> >
>> > But you definitely have VLAs in your exp function. However, that
>> shouldn't
>> > be the reason for your trouble.
>> >
>> >
>> > In gmpxx.h, make the mp*_class constructors and destructors print
>> >>> something.
>> >>>
>> >>
>> > Still my best advice. Actually, running the program inside ltrace
>> already
>> > gives a useful output.
>> >
>> > --
>> > Marc Glisse
>> >
>> _______________________________________________
>> gmp-discuss mailing list
>> gmp-discuss at gmplib.org
>> https://gmplib.org/mailman/listinfo/gmp-discuss
>>
>
>
More information about the gmp-discuss
mailing list