Skip to content

Commit

Permalink
Replace Mathematica .nb by a .m script, and adapt fateman.jl
Browse files Browse the repository at this point in the history
This saves LOT OF lines, and seems to be the correct way of comparing
the time of the calculation. The time returned is the minimum time
of performing 5 times the calculation.

To be fair, fateman.jl also computes 5 times and returns the minimum
one. A fair comparison of what Mathematica does, one has to compare with
fateman2 or fateman4 output.
  • Loading branch information
Luis Benet committed Aug 7, 2015
1 parent f9791da commit 4c622dd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 88,393 deletions.
8 changes: 7 additions & 1 deletion perf/fateman.jl
@@ -1,3 +1,4 @@
include("/Users/benet/Fisica/6-IntervalArithmetics/TaylorSeries.jl/src/TaylorSeries.jl")
using TaylorSeries

x, y, z, w = set_variables(Int128, "x", numvars=4, order=40)
Expand Down Expand Up @@ -45,8 +46,13 @@ function run_fateman(N)
println("Running $f")
@time result = f(N)
push!(results, result)
t = Inf
for i = 1:5
ti = @elapsed f(N)
t = min(t,ti)
end
println("\t Min time of 5 runs:", t)
end

results
end

Expand Down
27 changes: 27 additions & 0 deletions perf/timing_Fateman.m
@@ -0,0 +1,27 @@
(* Timing a test by Fateman
In a mac, run this as
/Applications/Mathematica.app/Contents/MacOS/MathematicaScript -script ./timing_Fateman.m)
The `timeit` function is slightly modified from
https://github.com/JuliaLang/julia/blob/master/test/perf/micro/perf.nb
which is licensed under MIT
*)

ClearAll[timeit];
SetAttributes[timeit, HoldFirst];
timeit[ex_, name_String] := Module[
{t},
t = Infinity;
Do[
t = Min[t, N[First[AbsoluteTiming[ex]]]];
,
{i, 1, 5}
];
Print["mathematica,", name, ",min(time),", t];
];

(* Print[First[AbsoluteTiming[Function[n,Expand[(1+x+y+z+w)^n * (1+(1+x+y+z+w)^n)]][20]]]] *)

timeit[Function[n,Expand[(1+x+y+z+w)^n * (1+(1+x+y+z+w)^n)]][20],"fateman"]

0 comments on commit 4c622dd

Please sign in to comment.