comp.lang.ada
 help / color / mirror / Atom feed
From: "Clifford J. Nelson" <cnelson9@gte.net>
Subject: Re: ratioanl number type
Date: 1999/12/11
Date: 1999-12-11T00:00:00+00:00	[thread overview]
Message-ID: <385252FF.BB4C7A5@gte.net> (raw)
In-Reply-To: 3847E5B3.B96339A8@iforex.net



Dmitriy Anisimkov wrote:

> "Clifford J. Nelson" wrote:
>
> > Are there any Ada95 examples in books or on the web that implement the
> > exact rational number data type,
>
> .......
>
> > available
> > memory should be the only limit to their size.
>
> Try  http://www.chat.ru/~vagul/Unlimit7.zip

A timing test of GNAT Ada95 CodeBuilder 1.1 exact rational numbers with
unlimited size integers using http://www.chat.ru/~vagul/Unlimit7.zip
compared to Mathematica 3.01.

Ada95 took 4861.733319000 seconds. Mma took 15.2667 seconds.

First[Timing[vtt = tt[t]-a]]
15.2667 Second

4861.733319000/15.2667
318.453

Mathematica unlimited exact rational arithmetic is 318 times faster in this
test.

Here is the Mathematica code. Translate it into other languages or use
other packages in Ada and see how long it takes. vtt should be all zeros
(97 of them). Other odd primes instead of 97 should work too. So, test it
for 5 first to see if it works.

See:
http://forum.swarthmore.edu/epigone/geometry-research/brydilyum

tt[x_] := timesbnum[x,divperm[x]]

eigen[x_,n_] :=Append[x[[Mod[Range[Length[x]-1]*n, Length[x]] ]],Last[x]]

conjugate[x_] :=
  Module[{xx = eigen[x,2]},
    Do[xx = timesbnum[xx,eigen[x,i]],{i,3,Length[x]-1}];xx]

procal[x_,y_] :=y/((-y.Reverse[x])/Length[x])

divperm[x_] :=procal[x,conjugate[x]]

timesbnum[x_, y_] := dt[-Reverse[x], y, Length[x]]

dt[x_, y_, n_] := Table[RotateRight[x, i] . y, {i, 0, n - 1}]/n

makezero[x_] := Join[x, {-Plus @@ x}]

a = makezero[Table[1,{96}]]

t = makezero[Range[96]]

First[Timing[vtt = tt[t]-a]]
15.2667 Second

4861.733319000/15.2667
318.453

   Cliff Nelson





  reply	other threads:[~1999-12-11  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-03  0:00 ratioanl number type Clifford J. Nelson
1999-12-03  0:00 ` Gautier
1999-12-03  0:00 ` Tucker Taft
1999-12-03  0:00 ` Dmitriy Anisimkov
1999-12-11  0:00   ` Clifford J. Nelson [this message]
1999-12-11  0:00     ` Robert Dewar
     [not found]     ` <01bf43ea$646d5bc0$022a6282@dieppe>
1999-12-11  0:00       ` Clifford J. Nelson
     [not found]         ` <01bf43f3$3aadb600$022a6282@dieppe>
1999-12-11  0:00           ` Vladimir Olensky
1999-12-12  0:00             ` Robert Dewar
1999-12-12  0:00               ` Vladimir Olensky
1999-12-12  0:00                 ` MMX (was Re: ratioanl number type) Vladimir Olensky
1999-12-14  0:00                 ` ratioanl number type Robert Dewar
1999-12-17  0:00                 ` Gisle S�lensminde
1999-12-19  0:00                   ` Robert Dewar
1999-12-12  0:00         ` Robert Dewar
1999-12-09  0:00 ` rational " Wes Groleau
  -- strict thread matches above, loose matches on Subject: below --
1999-12-15  0:00 ratioanl " Alexander E. Kopilovitch
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox