Füge fehlende Bild-Dateien hinzu.
[diplomarbeit.git] / images / markov-comparators-to-percent.px
diff --git a/images/markov-comparators-to-percent.px b/images/markov-comparators-to-percent.px
new file mode 100755 (executable)
index 0000000..f34f18b
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $iterations = 0;
+my $comparators = 0;
+my %data = ();
+
+while (<>)
+{
+       chomp;
+       my ($x, $y) = split;
+
+       $iterations += $y;
+       $comparators += ($x * $y);
+       $data{$x} = $y;
+}
+
+print "# Iterations: $iterations\n";
+printf "# Average: %.6f\n", $comparators / $iterations;
+for (sort { $a <=> $b } (keys %data))
+{
+       printf "%-4i %.6f\n", $_, 100.0 * $data{$_} / $iterations;
+}