changeset 11582:dbc62fd39423 octave-forge

small bugfix to the tester. the obench program will also benchmark colamd-preordered matrices.
author michelemartone
date Sun, 31 Mar 2013 16:21:54 +0000
parents 4c91dd3872e0
children 0b64fe2f4753
files main/sparsersb/src/obench.m main/sparsersb/src/sparsersbtester.m
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/sparsersb/src/obench.m	Sun Mar 31 15:57:29 2013 +0000
+++ b/main/sparsersb/src/obench.m	Sun Mar 31 16:21:54 2013 +0000
@@ -1,7 +1,8 @@
 # once complete, this program will benchmark our matrix implementation against octave's
-
+cmt="#";
 #for n_=1:6*0+1
 for n_=1:6
+for ro=0:1
 	n=n_*1000;
 	m=k=n;
 	# making vectors
@@ -11,13 +12,26 @@
 	# making matrices
 	r=(rand(n)>.6);
 	om=sparse(r);
+	nz=nnz(om);
+	M=10^6;
+	if ro==1 
+		printf("%s%s\n",cmt,"reordering with colamd");
+		pct=-time; 
+		p=colamd(om);
+		pct+=time;
+		pat=-time; 
+		om=om(:,p);
+		pat+=time;
+		# TODO: use an array to select/specify the different reordering algorithms
+		printf("%g\t%g\t(%s)\n",(nz/M)/pct,(nz/M)/pat,"mflops for pct/pat");
+	else
+		printf("%s%s\n",cmt,"no reordering");
+	end
 	#bm=sparsevbr(om);
 	bm=sparsersb(sparse(om));
 	#bm=sparsersb3(sparse(om));
 	# stats
-	nz=nnz(om);
 	flops=2*nz;
-	M=10^6;
 	## spmv
 	ot=-time; ox=om*b; ot+=time;
 	#
@@ -45,3 +59,4 @@
 	t=bt; p=["RSB"]; mflops=n*(flops/M)/t;
 	printf("%s\t%d\t%d\t%d\t%g\t%s\n","RSB_SPGEMM",m,k,nz,mflops, p);
 endfor
+endfor
--- a/main/sparsersb/src/sparsersbtester.m	Sun Mar 31 15:57:29 2013 +0000
+++ b/main/sparsersb/src/sparsersbtester.m	Sun Mar 31 16:21:54 2013 +0000
@@ -280,7 +280,9 @@
 
 function match=testnorm(OM,XM)
 	match=1;
-	match&=isequal(normest(OM),normest(XM));
+	if(isreal(OM))
+		match&=isequal(full(normest(OM)),full(normest(XM)));
+	end
 	testmsg(match,"norms");
 end