--- /dev/null
+#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 "</svg>
+<p>
+ The graph shows the average number of common row factors
+ of <i>U</i> in the <i>LD<sup>-1</sup>U</i> decomposition of <i>A</i>.
+ For each <i>n</i> we generated %d random <i>n</i>-by-<i>n</i> matrices
+ <i>A</i> with entries of degree at most %d. The factor count ignores the
+ last row since it always contains only det <i>A</i>.
+</p>
+<p>
+ The ratio of the number of the predicted factors versus all the factors
+ was on average %.2f%% (with a deviation of %.2f%%).
+</p>" 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)[<i>x</i>]";
+ defs total predict;
+ axes "<tspan font-style=\"italic\">n</tspan>" "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 <INT>"
+
+
+
+let () =
+ Arg.parse argspec anonarg usage;
+ main !samples total2 predict2