@@ -14,7 +14,7 @@ make_latex_header <- function(names){
1414    for (i  in  1 : length(names )){
1515        clines  <-  paste(clines ," \\ cmidrule{" 3 * i ," -" 3 * i + 1 ," }" sep = " " 
1616    }
17-     y  <-  paste(" \\ toprule" x , " \\\\ " clines ," \n "      
17+     y  <-  paste(" \\ toprule" x , " \\\\ " clines ," \n " 
1818    gsub(" _" " \\\\ _" y )
1919}
2020
@@ -25,70 +25,51 @@ cat(paste(readLines("lcp-header.tex"),collapse="\n"))
2525maindata  <-  data_frame_from_key_value_pairs( " ../results/all.txt" 
2626
2727names <- c(" SA" " BWT" " LCP" " OVERALL" 
28- unitrow  <-  paste(c(" " " &&(s)" " &(\\ %)" names )), " \\\\ [1ex]" collapse = " " sep = ' ' 
29- # subhead <- paste(c("", rep(c("&&Time","&Space"),length(names)), "\\\\[1ex]"),collapse="",sep='')
28+ unitrow  <-  paste(c(" " " &&Time" " &Space" names )), " \\\\ " " " " &&(sec)" " &(\\ %)" names )), " \\\\ [1ex]" collapse = " " sep = ' ' 
3029
3130#  create a table for each test case
3231for (i  in  1 : nrow(maindata )){
3332
3433	data <- maindata [i ,]
35- 	row <- nrow(lcp_config )+ 1 
34+ 	row <- nrow(lcp_config )
3635	size <- data [[" TC_SIZE" 
3736	table <- data.frame (EMPTY = character (row ),SATIME = character (row ),SASPACE = character (row ),EMPTY2 = character (row ),BWTTIME = character (row ),BWTSPACE = character (row ),EMPTY3 = character (row ),LCPTIME = character (row ),LCPSPACE = character (row ),EMPTY4 = character (row ),OVERALLTIME = character (row ),OVERALLSPACE = character (row ),stringsAsFactors = FALSE )
38- 	
39- 	# create subheader
40- 	
41- 	table [1 ,][" SATIME" <- " Time" 
42- 	table [1 ,][" SASPACE" <- " Space" 
43- 	table [1 ,][" BWTTIME" <- " Time" 
44- 	table [1 ,][" BWTSPACE" <- " Space" 
45- 	table [1 ,][" OVERALLTIME" <- " Time" 
46- 	table [1 ,][" OVERALLSPACE" <- " Space" 
47- 	table [1 ,][" LCPTIME" <- " Time" 
48- 	table [1 ,][" LCPSPACE" <- " Space" 
4937
5038	#  gather data
51- 	for (l  in  2 : row ){
52- 		
39+ 	for (l  in  1 : row ){
5340		table [l ,][" SATIME" <- sprintf(" %.2f" data [[" SA_TIME" 
5441		table [l ,][" SASPACE" <- round(data [[" SA_MMPEAK" * 100 / size , digits = 0 )
5542
5643
57- 		if (lcp_config [[" BWT" l - 1 ]){
44+ 		if (lcp_config [[" BWT" l ]){
5845			table [l ,][" BWTTIME" <- sprintf(" %.2f" data [[" BWT_TIME" 
5946			table [l ,][" BWTSPACE" <- round(data [[" BWT_MMPEAK" * 100 / size , digits = 0 )
60- 			table [l ,][" OVERALLTIME" <- sprintf(" %.2f" data [[" SA_TIME" + data [[" BWT_TIME" + data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _TIME" sep = " " 
61- 			table [l ,][" OVERALLSPACE" <- round(max(data [[" SA_MMPEAK" data [[" BWT_MMPEAK" data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
47+ 			table [l ,][" OVERALLTIME" <- sprintf(" %.2f" data [[" SA_TIME" + data [[" BWT_TIME" + data [[paste(lcp_config [[" LCP_ID" l ]," _TIME" sep = " " 
48+ 			table [l ,][" OVERALLSPACE" <- round(max(data [[" SA_MMPEAK" data [[" BWT_MMPEAK" data [[paste(lcp_config [[" LCP_ID" l ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
6249		}
6350		else {
6451			table [l ,][" BWTTIME" <- " -" 
6552			table [l ,][" BWTSPACE" <- " -" 
66- 			table [l ,][" OVERALLTIME" <- sprintf(" %.2f" data [[" SA_TIME" + data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _TIME" sep = " " 
67- 			table [l ,][" OVERALLSPACE" <- round(max(data [[" SA_MMPEAK" data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
53+ 			table [l ,][" OVERALLTIME" <- sprintf(" %.2f" data [[" SA_TIME" + data [[paste(lcp_config [[" LCP_ID" l ]," _TIME" sep = " " 
54+ 			table [l ,][" OVERALLSPACE" <- round(max(data [[" SA_MMPEAK" data [[paste(lcp_config [[" LCP_ID" l ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
6855		}
6956
70- 		table [l ,][" LCPTIME" <- sprintf(" %.2f" data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _TIME" sep = " " 
71- 		table [l ,][" LCPSPACE" <- round(data [[paste(lcp_config [[" LCP_ID" l - 1 ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
57+ 		table [l ,][" LCPTIME" <- sprintf(" %.2f" data [[paste(lcp_config [[" LCP_ID" l ]," _TIME" sep = " " 
58+ 		table [l ,][" LCPSPACE" <- round(data [[paste(lcp_config [[" LCP_ID" l ]," _MMPEAK" sep = " " * 100 / size , digits = 0 )
7259	}
73- 	
7460
75- 	row.names(table )<- c( " " , lcp_config [[" LATEX_NAME" ) 
61+ 	row.names(table )<- lcp_config [[" LATEX_NAME" 
7662
7763	#  convert and print table
7864	ali  <-  c(" l" " @{\\ hspace{1ex}}l" " c" " c" table ))/ 3 ) )
7965	dig  <-  c(0 ,  rep(c(0 ,3 ,0 ),(ncol(table ))/ 3  ))
8066
81- 	
82- 	print(	xtable(table ,
83- 			align = ali ,
84- 			digits = dig ,
85- 			caption  =  paste(" " data [[" TC_TEX_NAME" "  (size: " size / (1024 ^ 2 ),digits = 3 )," MB)" 
86- 			),
87-            	add.to.row = list (pos = list (- 1 ,0 ,nrow(table )), 
88-                            command = c(make_latex_header(names ),unitrow ," \\ bottomrule" 
89- 			hline.after = c(),			 
67+ 	print(	xtable(table , align = ali , digits = dig ,
68+ 			caption  =  paste(" Results for " data [[" TC_TEX_NAME" "  (size: " size / (1024 ^ 2 ), digits = 3 )," MB). Runtime in seconds. Space is the peak memory usage (including input and output) as fraction of original file size." 
69+            	add.to.row = list (pos = list (- 1 ,0 ,nrow(table )), command = c(make_latex_header(names ),unitrow ," \\ bottomrule" 
70+ 		hline.after = c(),
9071           	sanitize.rownames.function  =  identity ,
91- 			 include.colnames  =  FALSE 
72+ 		include.colnames  =  FALSE 
9273	)
9374}
9475
0 commit comments