From: <mic...@us...> - 2011-11-25 21:49:55
|
Revision: 9191 http://octave.svn.sourceforge.net/octave/?rev=9191&view=rev Author: michelemartone Date: 2011-11-25 21:49:48 +0000 (Fri, 25 Nov 2011) Log Message: ----------- sparsersb: added a first librsb introspection feature (sparsersb("?")). Modified Paths: -------------- trunk/octave-forge/main/sparsersb/src/sparsersb.cc trunk/octave-forge/main/sparsersb/src/sparsetester.m Modified: trunk/octave-forge/main/sparsersb/src/sparsersb.cc =================================================================== --- trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2011-11-25 21:01:49 UTC (rev 9190) +++ trunk/octave-forge/main/sparsersb/src/sparsersb.cc 2011-11-25 21:49:48 UTC (rev 9191) @@ -97,6 +97,7 @@ #define RSBOI_FNSS(S) #S //#define RSBOI_FNS RSBOI_FNSS(RSB_SPARSERSB_LABEL) #define RSBOI_FNS "sparsersb" +#define RSBOI_LIS "?" #define RSBIO_DEFAULT_CORE_MATRIX Matrix (0,0) /* FIXME : octave_idx_type vs rsb_coo_index_t */ @@ -1468,7 +1469,8 @@ /*is forced back to a full matrix if resulting matrix is sparse\n*/\ "\n\ @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{filename})\n\ -Create a sparse RSB matrix by loading the Matrix Market matrix file from string @var{filename}.\n"\ +Create a sparse RSB matrix by loading the Matrix Market matrix file named @var{filename}.\n"\ +"In the case @var{filename} is \""RSBOI_LIS"\", a string listing the available numerical types with BLAS-style characters will be returned.\n"\ "\n\ @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ Create a sparse RSB matrix given integer index vectors @var{i} and @var{j},\n\ @@ -1581,9 +1583,17 @@ if(args(0).is_string()) { const std::string m = args(0).string_value(); - RSBOI_WARN(RSBOI_0_UNFFEMSG); if (error_state) goto err; - retval.append(matrix=new octave_sparse_rsb_matrix(m)); + if(m==RSBOI_LIS) + { + retval.append(RSB_NUMERICAL_TYPE_PREPROCESSOR_SYMBOLS); + goto ret; + } + else + { + RSBOI_WARN(RSBOI_0_UNFFEMSG);/* FIXME: shall set the type, here */ + retval.append(matrix=new octave_sparse_rsb_matrix(m)); + } } else { Modified: trunk/octave-forge/main/sparsersb/src/sparsetester.m =================================================================== --- trunk/octave-forge/main/sparsersb/src/sparsetester.m 2011-11-25 21:01:49 UTC (rev 9190) +++ trunk/octave-forge/main/sparsersb/src/sparsetester.m 2011-11-25 21:49:48 UTC (rev 9191) @@ -2,6 +2,8 @@ # # A comparative tester for sparsersb. # +# TODO: shall integrate with the rsb.m tester +# function testmsg(match,tname,erreason) if(match) @@ -216,6 +218,15 @@ end match=1; +mtn=1; + +if (strchr(sparsersb("?"),"Z")>0) + mtn++; +endif + +for mti=1:mtn +wc=(mti==2); + dim=3; #M=(rand(dim)>.8)*rand(dim);M(1,1)=11; @@ -224,16 +235,12 @@ #match&=tests(OM,XM); M=[1]; +if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); -# TODO: shall implement a functionality to verify whether sparsersb is configured to support complex -# TODO: shall integrate with the rsb.m tester -#M=[i]; -#OM=sparse(M); XM=sparsersb(M); -#match&=tests(OM,XM); - M=zeros(4)+sparse([1,2,3,2,4],[1,2,3,1,4],[11,22,33,21,44]); +if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); @@ -246,6 +253,7 @@ #match&=tests(OM,XM); M=diag(10); +if(wc)M+=M*i;end OM=sparse(M); XM=sparsersb(M); match&=tests(OM,XM); @@ -253,6 +261,8 @@ #OM=sparse(M); XM=sparsersb(M); #match&=tests(OM,XM); +end + if(match) printf("All tests passed.\n"); else printf("Failure while performing tests!\n");end # FIXME: shall print a report in case of failure. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |