###
set style function lines

set style line 1 lw 4 lt 1 lc rgb "red" pointtype 13 pointsize 2
set style line 2 lw 4 lt 2 lc rgb "red" pointtype 14 pointsize 2
set style line 3 lw 4 lt 1 lc rgb "blue" pointtype 9 pointsize 2
set style line 4 lw 4 lt 2 lc rgb "blue" pointtype 2 pointsize 2
set style line 5 lw 4 lt 1 lc rgb "black" pointtype 3 pointsize 2
set style line 6 lw 4 lt 2 lc rgb "black"   pointtype 1 pointsize 2

set style line 7 lw 4 lt 1 lc rgb "green"   pointtype 6 pointsize 2
set style line 8 lw 4 lt 1 lc rgb "orange"   pointtype 12 pointsize 2


set xlabel "Parallelism degree" rotate parallel
set ylabel "Stream length" rotate parallel
set zlabel "Secs" rotate parallel 
set grid
set grid ztics
set terminal postscript color font 'Helvetica,16'
set out "plot1.eps"
splot "ciccio" matrix columnheaders rowheaders with lines lw 3  notitle

set terminal postscript enhanced font 'Helvetica,22'
set ylabel "Speedup"
set out "plot3.eps"
set key top left
set logscale x 2 
set logscale y 2 
plot x title "Ideal" ls 1, "approx.dat" using 1:5 with linespoints title "10x" ls 3, "approx.dat" using 1:2 with linespoints title "5x" ls 5, "approx.dat" using 1:3 with linespoints title "2x" ls 7,  "approx.dat" using 1:4 with linespoints title "1x" ls 8
set ylabel "secs"

set key top right
set ylab "secs" 
set out "plot4.eps"
ideal(x) = 10.378 / x
### plot "accu1.dat" using 1:2 title "Measured, Tf = 100 T(+)" with linespoints, "" using 1:3 title "Ideal, Tf = 100 T(+)" with linespoints, "" using 1:4 title "Measured, Tf = T(+)" with linespoints, 5.20 with linespoints title "Ideal, Tf = T(+)"
plot "accu1.dat" using 1:2 title "Measured, Tf = 100 T(+)" with linespoints, ideal(x) title "Ideal"

set out "plot5.eps"
set logscale y 2
ideal2acc(x) = 6.25 / x
### plot "accu2.dat" using 1:2 title "Freq = 1" with linespoints, "" using 1:3 title "Freq = 8" with linespoints, "" using 1:4 title "Freq = 16" with linespoints, ideal2acc(x) title "Ideal"
plot "accu2.dat" using 1:2 title "Freq = 1" with linespoints, "" using 1:3 title "Freq = 8" with linespoints, "" using 1:4 title "Freq = 16" with linespoints

### 100x 50x con freq
set out "plot5bis.eps"
#set key bottom left
#unset logscale x
### plot "accu2.dat" using 1:2 title "(50x,freq = 1)" with linespoints, "" using 1:3 title "(50x, freq = 8)" with linespoints, "" using 1:4 title "(50x, freq = 16)" with linespoints, ideal2acc(x) title "Ideal (50x)", "accu1.dat" using 1:2 title "(100x, freq=1)" with linespoints, "" using 1:3 title "Ideal (100x)"
ideal5x(x) = 12.7971 / x
set ytics ("16" 16, "8" 8, "4" 4, "2" 2, "1" 1, "1/2" 0.5, "1/4" 0.25, "1/8" 0.125, "1/16" 0.0625) 
plot "accu3.dat" using 1:2 title "f = 1" with linespoints ls 3, "" using 1:3 title "f = 8" with linespoints ls 5, "" using 1:4 title "f = 16" with linespoints ls 7,  ideal5x(x) title "Ideal" ls 1

set xlabel "Parallelism degree" 
set ylabel "secs"
set key top left
set xtics ( "1" 1, "2" 2, "4" 4, "8" 8, "16" 16, "32" 32, "64" 64, "96" 96, "128" 128)
set yrange [1:64]
set ytics ( "1" 1, "2" 2, "4" 4, "8" 8, "16" 16, "32" 32, "64" 64)

#paraphrase
set ylabel "Speedup"
set out "plot6.eps"
plot "allornone1.dat" using 1:2 title "Ideal p=0.01" with lines ls 1, "" using 1:3 title "p=0.01" with linespoints ls 2, "" using 1:4 title "Ideal p=0.1" with lines ls 3, "" using 1:5 title "p=0.1" with linespoints ls 4, "" using 1:6 title "Ideal p=0.2" with lines ls 5, "" using 1:7 title "p=0.2" with linespoints ls 6

#ninja
set out "plot7.eps"
plot "allornone2.dat" using 1:2 title "Ideal p=0.01" with lines ls 1, "" using 1:3 title "p=0.01" with linespoints ls 2, "" using 1:4 title "Ideal p=0.1" with lines ls 3, "" using 1:5 title "p=0.1" with linespoints ls 4, "" using 1:6 title "Ideal p=0.2" with lines ls 5, "" using 1:7 title "p=0.2" with linespoints ls 6

# separate
set out "plot8.eps"
id50(x) = 51
id100(x) = 101
id20(x) = 21
set key bottom right
unset logscale x
set ytics ( "1" 1, "2" 2, "4" 4, "8" 8, "16" 16, "21" 21, "51" 51, "101" 101)
set ylab "Speedup"
set yrange [1:150]
## unset logscale y
plot id100(x) title "ideal 100x" ls 1, "sep.dat" using 1:3 with linespoints title "100x" ls 2, id50(x) title "ideal 50x" ls 3, "" using 1:5 with linespoints title "50x" ls 4, id20(x) title "ideal 20x" ls 5, "" using 1:7 with linespoints title "20x" ls 6

# accumulatore speedup
set out "plot9.eps"
ideal(x) = x
plot "accusp50.dat" using 1:2 title "50x,f=1" with linespoints, "" using 1:4 title "50x,f=8" with linespoints, "" using 1:5 title "50x,f=16" with linespoints, "accusp5.dat" using 1:2 title "5x,f=1" with linespoints, "" using 1:3 title "5x,f=8" with linespoints,  "" using 1:3 title "5x,f=16" with linespoints, ideal(x) title "Ideal"