comparison main/sparsersb/src/sparsersb.cc @ 12647:f4cf214fe3a4 octave-forge

The interface to rsb_mtx_get_info_str will at least return the result of RSB_MIF_MATRIX_INFO__TO__CHAR_P now. Documented this as well.
author michelemartone
date Sun, 21 Jun 2015 19:48:24 +0000
parents cca1aed268cc
children bdd6ce97fa37
comparison
equal deleted inserted replaced
12646:cca1aed268cc 12647:f4cf214fe3a4
1992 \n\ 1992 \n\
1993 \ 1993 \
1994 If @var{mif} is a string specifying a valid librsb matrix info string (valid for librsb's @code{rsb_mtx_get_info_from_string()}), then the corresponding value will be returned for matrix @code{@var{A}}, in string @code{@var{v}}. If @var{mif} is the an empty string (\"\"), matrix structure information will be returned.\n\ 1994 If @var{mif} is a string specifying a valid librsb matrix info string (valid for librsb's @code{rsb_mtx_get_info_from_string()}), then the corresponding value will be returned for matrix @code{@var{A}}, in string @code{@var{v}}. If @var{mif} is the an empty string (\"\"), matrix structure information will be returned.\n\
1995 \n\ 1995 \n\
1996 \ 1996 \
1997 If @var{A} is a " RSBOI_FNS " matrix and @var{QS} is a string, @var{QS} will be interpreted as a query string about matrix @var{A}. String @code{@var{v}} will be returned.\n\ 1997 If @var{A} is a " RSBOI_FNS " matrix and @var{QS} is a string, @var{QS} will be interpreted as a query string about matrix @var{A}. String @code{@var{v}} will be returned. See librsb's @code{rsb_mtx_get_info_str()}.\n\
1998 @strong{Note}: this feature is still incomplete, and whatever the value of @var{QS}, a general information string will be returned.\n\
1998 \n"\ 1999 \n"\
1999 /*If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ 2000 /*If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\
2000 to have a common size.\n*/ 2001 to have a common size.\n*/
2001 RSBOI_10100_DOC ""\ 2002 RSBOI_10100_DOC ""\
2002 "\n\ 2003 "\n\
2190 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ 2191 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
2191 2192
2192 if (nargin == 2 && isr && args(1).is_string()) 2193 if (nargin == 2 && isr && args(1).is_string())
2193 { 2194 {
2194 char ss[RSBOI_INFOBUF]; 2195 char ss[RSBOI_INFOBUF];
2196 rsb_err_t errval = RSB_ERR_NO_ERROR;
2197
2195 if(!osmp || !osmp->mtxAp)goto ret;/* FIXME: error handling missing here */ 2198 if(!osmp || !osmp->mtxAp)goto ret;/* FIXME: error handling missing here */
2196 rsb_mtx_get_info_str(osmp->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); 2199 errval = rsb_mtx_get_info_str(osmp->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF);
2197 /* FIXME: to add interpretation */ 2200 if(!RSBOI_SOME_ERROR(errval))
2201 retval.append(ss);
2202 /* TODO, FIXME: to add interpretation (we are ignoring args(1) !): this is unfinished */
2198 RSBOI_WARN(RSBOI_0_UNFFEMSG);/* FIXME: this is yet unfinished */ 2203 RSBOI_WARN(RSBOI_0_UNFFEMSG);/* FIXME: this is yet unfinished */
2199 // octave_stdout << "Matrix information (in the future, supplementary information may be returned, as more inquiry functionality will be implemented):\n" << ss << "\n"; 2204 // octave_stdout << "Matrix information (in the future, supplementary information may be returned, as more inquiry functionality will be implemented):\n" << ss << "\n";
2200 /* FIXME: shall not print out, but rather return the info as a string*/ 2205 /* FIXME: shall not print out, but rather return the info as a string*/
2201 //retval.append("place info string here !\n"); 2206 //retval.append("place info string here !\n");
2202 goto ret; 2207 goto ret;
2452 %!test 2457 %!test
2453 %! sparsersb("set","RSB_IO_WANT_VERBOSE_TUNING","1") 2458 %! sparsersb("set","RSB_IO_WANT_VERBOSE_TUNING","1")
2454 %!test 2459 %!test
2455 %! # sparsersb("get","RSB_IO_WANT_VERBOSE_TUNING","1") 2460 %! # sparsersb("get","RSB_IO_WANT_VERBOSE_TUNING","1")
2456 %!test 2461 %!test
2462 %! sparsersb(sparsersb([11,0;21,22]),"RSB_MIF_TOTAL_SIZE__TO__SIZE_T")
2463 %!test
2457 %! sparsersb(sparsersb([11,0;21,22]),"save","sparsersb_temporary_matrix_file.mtx") 2464 %! sparsersb(sparsersb([11,0;21,22]),"save","sparsersb_temporary_matrix_file.mtx")
2458 %!test 2465 %!test
2459 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx" ); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="real" );assert(SYMMETRY=='U'); 2466 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx" ); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="real" );assert(SYMMETRY=='U');
2460 %!test 2467 %!test
2461 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx", "Z"); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="complex");assert(SYMMETRY=='U'); 2468 %! [S, NROWS, NCOLS, NNZ, REPINFO, FIELD, SYMMETRY] = sparsersb("sparsersb_temporary_matrix_file.mtx", "Z"); assert(NROWS==2);assert(NCOLS==2);assert(NNZ==3);assert(FIELD=="complex");assert(SYMMETRY=='U');