--- a/data.sty Sun Oct 02 14:07:42 2016 +0100
+++ b/data.sty Sun Oct 02 15:07:21 2016 +0100
@@ -71,7 +71,7 @@
28 29.81185
\end{filecontents}
-%% Scala V1, example a?{n} a{n}
+%% re1.scala: example a?{n} a{n}
\begin{filecontents}{re1.data}
1 0.00179
2 0.00011
@@ -97,50 +97,41 @@
\end{filecontents}
-%% Scala V1, example (a*)* b
+%% re1.scala: example (a*)* b
\begin{filecontents}{re1a.data}
-1 0.00013
-501 0.03610
-1001 0.08543
-1501 0.06424
-2001 0.11329
-2501 0.19428
-3001 0.31500
-3501 0.37748
-4001 0.49636
-4501 0.63803
-5001 0.75320
-5501 0.92438
-6001 1.01979
-6501 1.21709
+1 0.00063
+501 0.17873
+1001 0.38154
+1501 0.31391
+2001 0.44642
+2501 0.68948
+3001 0.96061
+3501 1.23515
+4001 1.77727
+4501 2.20843
+5001 2.54629
+5501 3.07348
+6001 3.63944
+6501 4.67416
\end{filecontents}
-%% Scala V2, example a?{n} a{n}
+%% re2.scala example a?{n} a{n}
\begin{filecontents}{re2.data}
-1 0.00004
-51 0.00079
-101 0.00752
-151 0.02008
-201 0.04462
-251 0.07715
-301 0.13366
-351 0.21700
-401 0.34163
-451 0.47499
-501 0.65810
-551 0.88666
-601 1.17030
-651 1.51570
-701 1.91133
-751 2.38194
-801 3.10061
-851 4.35828
-901 4.73774
-951 6.05984
-1001 6.68179
+1 0.00006
+101 0.00605
+201 0.04343
+301 0.16469
+401 0.41954
+501 0.83703
+601 1.66925
+701 2.71086
+801 4.19745
+901 7.56495
+1001 12.42103
+1101 20.41763
\end{filecontents}
-%% Scala V2, example (a*)* b
+%% re2.scala: example (a*)* b
\begin{filecontents}{re2a.data}
1 0.00009
501 0.02582
@@ -154,7 +145,7 @@
4501 0.81166
\end{filecontents}
-%% Scala V4, example a?{n} a{n}
+%% re3.scala: example a?{n} a{n}
\begin{filecontents}{re3.data}
1 0.001605
501 0.131066
@@ -182,7 +173,7 @@
11501 7.95864
\end{filecontents}
-%% Scala V4, example (a*)* b
+%% re3.scala: example (a*)* b
\begin{filecontents}{re3a.data}
1 0.00015
500001 0.16143
@@ -202,7 +193,7 @@
7500001 17.97648
\end{filecontents}
-%% Scala V5, example a?{n} a{n}
+%% re4.scala example a?{n} a{n}
\begin{filecontents}{re4.data}
1 0.00007
1000001 0.65112
@@ -214,7 +205,7 @@
7000001 26.39926
\end{filecontents}
-%% Scala V5, example (a*)* b
+%% re4.scala example (a*)* b
\begin{filecontents}{re4a.data}
1 0.00015
500001 0.18391
Binary file handouts/ho02.pdf has changed
--- a/handouts/ho02.tex Sun Oct 02 14:07:42 2016 +0100
+++ b/handouts/ho02.tex Sun Oct 02 15:07:21 2016 +0100
@@ -43,10 +43,8 @@
legend entries={Python,Ruby},
legend pos=north west,
legend cell align=left]
-\addplot[blue,mark=*, mark options={fill=white}]
- table {re-python.data};
-\addplot[brown,mark=triangle*, mark options={fill=white}]
- table {re-ruby.data};
+\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
+\addplot[brown,mark=triangle*, mark options={fill=white}] table {re-ruby.data};
\end{axis}
\end{tikzpicture}
&
@@ -64,7 +62,7 @@
axis lines=left,
width=6.5cm,
height=5cm]
-\addplot[green,mark=square*,mark options={fill=white}] table {re2b.data};
+\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
\end{axis}
\end{tikzpicture}
@@ -107,6 +105,7 @@
scaled ticks=false,
width=6.5cm,
height=5cm]
+\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
\end{axis}
\end{tikzpicture}
@@ -495,10 +494,8 @@
legend entries={Java,Scala V1},
legend pos=north east,
legend cell align=left]
-\addplot[cyan,mark=*, mark options={fill=white}]
- table {re-java.data};
-\addplot[red,mark=triangle*,mark options={fill=white}]
- table {re1a.data};
+\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
+\addplot[red,mark=triangle*,mark options={fill=white}] table {re1a.data};
\end{axis}
\end{tikzpicture}
\end{center}
@@ -537,12 +534,9 @@
legend entries={Python,Ruby,Scala V1},
legend pos=outer north east,
legend cell align=left]
-\addplot[blue,mark=*, mark options={fill=white}]
- table {re-python.data};
-\addplot[brown,mark=pentagon*, mark options={fill=white}]
- table {re-ruby.data};
-\addplot[red,mark=triangle*,mark options={fill=white}]
- table {re1.data};
+\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
+\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data};
+\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
\end{axis}
\end{tikzpicture}
\end{center}
@@ -597,14 +591,10 @@
legend entries={Python,Ruby,Scala V1,Scala V2},
legend pos=outer north east,
legend cell align=left]
-\addplot[blue,mark=*, mark options={fill=white}]
- table {re-python.data};
-\addplot[brown,mark=pentagon*, mark options={fill=white}]
- table {re-ruby.data};
-\addplot[red,mark=triangle*,mark options={fill=white}]
- table {re1.data};
-\addplot[green,mark=square*,mark options={fill=white}]
- table {re2.data};
+\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
+\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data};
+\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
+\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\end{axis}
\end{tikzpicture}
\end{center}
--- a/progs/re1.scala Sun Oct 02 14:07:42 2016 +0100
+++ b/progs/re1.scala Sun Oct 02 15:07:21 2016 +0100
@@ -68,15 +68,20 @@
(end - start)/(i * 1.0e9)
}
+//test: (a?{n}) (a{n})
for (i <- 1 to 20) {
println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
}
-
for (i <- 1 to 20) {
println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
}
+//test: (a*)* b
+for (i <- 1 to 6502 by 500) {
+ println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
+}
+
for (i <- 1 to 6502 by 500) {
println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
}
--- a/progs/re2.scala Sun Oct 02 14:07:42 2016 +0100
+++ b/progs/re2.scala Sun Oct 02 15:07:21 2016 +0100
@@ -54,15 +54,20 @@
(end - start)/(i * 1.0e9)
}
-for (i <- 1 to 100) {
- println(i + ": " + "%.5f".format(time_needed(1, matches(EVIL1(i), "a" * i))))
-}
-//a bit bolder tests
-for (i <- 1 to 1001 by 50) {
+//test: (a?{n}) (a{n})
+for (i <- 1 to 1101 by 100) {
println(i + " " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
}
+for (i <- 1 to 1101 by 100) {
+ println(i + " " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
+}
+
+//test: (a*)* b
+for (i <- 1 to 4501 by 500) {
+ println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
+}
for (i <- 1 to 4501 by 500) {
println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
--- a/progs/re3.scala Sun Oct 02 14:07:42 2016 +0100
+++ b/progs/re3.scala Sun Oct 02 15:07:21 2016 +0100
@@ -47,7 +47,7 @@
case (r1s, ONE) => r1s
case (r1s, r2s) => SEQ(r1s, r2s)
}
- case NTIMES(r1, n) => NTIMES(simp(r), n)
+ case NTIMES(r1, n) => NTIMES(simp(r1), n)
case r => r
}
@@ -78,16 +78,22 @@
(end - start)/(i * 1.0e9)
}
-val i = 5000
-println(i + " " + "%.5f".format(time_needed(10, matcher(EVIL1(i), "a" * i))))
+
+//test: (a?{n}) (a{n})
+for (i <- 1 to 10001 by 1000) {
+ println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i))))
+}
-for (i <- 1 to 9001 by 1000) {
+for (i <- 1 to 10001 by 1000) {
println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i))))
}
+//test: (a*)* b
+for (i <- 1 to 7500001 by 500000) {
+ println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i))))
+}
+
for (i <- 1 to 7500001 by 500000) {
println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i))))
}
-
-
Binary file slides/slides02.pdf has changed
--- a/slides/slides02.tex Sun Oct 02 14:07:42 2016 +0100
+++ b/slides/slides02.tex Sun Oct 02 15:07:21 2016 +0100
@@ -702,8 +702,8 @@
x label style={at={(1.05,0.0)}},
ylabel={time in secs},
enlargelimits=false,
- xtick={0,200,...,1000},
- xmax=1100,
+ xtick={0,200,...,1100},
+ xmax=1200,
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
@@ -713,14 +713,10 @@
legend pos=north west,
legend cell align=left
]
-\addplot[blue,mark=*, mark options={fill=white}]
- table {re-python.data};
-\addplot[brown,mark=pentagon*, mark options={fill=white}]
- table {re-ruby.data};
-\addplot[red,mark=triangle*,mark options={fill=white}]
- table {re1.data};
-\addplot[green,mark=square*,mark options={fill=white}]
- table {re2b.data};
+\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
+\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data};
+\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
+\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\end{axis}
\end{tikzpicture}
\end{center}
@@ -771,7 +767,7 @@
legend entries={Scala V2,Scala V3},
legend pos=north east
]
-\addplot[green,mark=square*,mark options={fill=white}] table {re2b.data};
+\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
\end{axis}
\end{tikzpicture}
@@ -799,12 +795,12 @@
axis lines=left,
width=9cm,
height=5cm,
- legend entries={Scala V3},
+ legend entries={Scala V2},
legend pos=north west,
legend cell align=left]
\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
-%%where is 2nd graph
-%%\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
+%% still needs to be done
+%%\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
\end{axis}
\end{tikzpicture}
\end{center}