From 0f7d6adf5925e95e6e1701eead3b2cf457173fb0 Mon Sep 17 00:00:00 2001 From: Johannes Middeke Date: Tue, 10 May 2016 14:02:29 -0400 Subject: [PATCH] Forgot to add script. --- makeHTMLfactors.ml | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 makeHTMLfactors.ml diff --git a/makeHTMLfactors.ml b/makeHTMLfactors.ml new file mode 100644 index 0000000..41b03f8 --- /dev/null +++ b/makeHTMLfactors.ml @@ -0,0 +1,68 @@ +#use "dataFACTORS.ml";; +#use "prepareData.ml";; +#use "commonSVG.ml";; + +(* End the SVG picture and show the description of the experiment. *) + +let description ~degree ~number ~ratio ~deviation = Printf.printf " +

+ The graph shows the average number of common row factors + of U in the LD-1U decomposition of A. + For each n we generated %d random n-by-n matrices + A with entries of degree at most %d. The factor count ignores the + last row since it always contains only det A. +

+

+ The ratio of the number of the predicted factors versus all the factors + was on average %.2f%% (with a deviation of %.2f%%). +

" number degree (100.*.ratio) (100.*.deviation) + + + + + +(* Putting everything together. *) + +let main samples total predict = + let coords = map_coords ~width:90. ~height:120. in + head "Common Factor Degrees" "Common Factor Degrees over GF(2)[x]"; + defs total predict; + axes "n" "factor degrees"; + ticks coords ~x:80 ~step_x:5 ~y:110 ~step_y:10 (); + mean + |> List.map (fun (n,(_,t)) -> (float n, t)) + |> graph coords total "total"; + mean + |> List.map (fun (n,(p,_)) -> (float n, p)) + |> graph coords predict "prediction"; + description + ~degree:5 ~number:samples ~ratio:mean_ratio ~deviation:deviation_ratio; + foot () + + +(* *) + +let samples = ref 0 +let set_samples n = samples := n + +let degrees = ref 5 +let set_degrees n = degrees := n + +let argspec = + [ "--samples", + Arg.Int set_samples, + "Number of samples for the experiment."; + + "--degrees", + Arg.Int set_degrees, + "Maximal degree of the matrix entries."] +and anonarg s = + failwith ("Unknown argument " ^ s ^ ".") +and usage = + Sys.executable_name ^ " --samples " + + + +let () = + Arg.parse argspec anonarg usage; + main !samples total2 predict2 -- 2.1.4