changeset 4932:8c1d507a7b77

of-sparsersb: add patch for dev octave (Bug #55325) * src/of-sparsersb-1-deprecated.patch: new file * dist-files.mk: add ref to patch
author John Donoghue
date Mon, 21 Jan 2019 08:47:11 -0500
parents 79edc3a96749
children fa3095a87fa7
files dist-files.mk src/of-sparsersb-1-deprecated.patch
diffstat 2 files changed, 210 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Mon Jan 21 08:47:10 2019 -0500
+++ b/dist-files.mk	Mon Jan 21 08:47:11 2019 -0500
@@ -526,6 +526,7 @@
   of-signal.mk \
   of-sockets-1-cross-fixes.patch \
   of-sockets.mk \
+  of-sparsersb-1-deprecated.patch \
   of-sparsersb.mk \
   of-specfun-1-deprecated.patch \
   of-specfun.mk \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/of-sparsersb-1-deprecated.patch	Mon Jan 21 08:47:11 2019 -0500
@@ -0,0 +1,209 @@
+diff -r df6951233012 src/sparsersb.cc
+--- a/src/sparsersb.cc	Fri Jun 22 23:28:18 2018 +0200
++++ b/src/sparsersb.cc	Sun Jan 20 22:15:20 2019 +0100
+@@ -68,6 +68,7 @@
+ 
+ #define RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE 1
+ 
++#include <octave/interpreter.h>
+ #include <octave/oct.h>
+ #include <octave/ov-re-mat.h>
+ #include <octave/ov-re-sparse.h>
+@@ -902,7 +903,7 @@
+ 			error("save_binary() " RSBOI_0_NIYERRMSG);
+ 			return false;
+ 		}
+-		bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt)
++		bool load_binary (std::istream& is, bool swap, octave::mach_info::float_format fmt)
+ 		{
+ 			error("load_binary() " RSBOI_0_NIYERRMSG);
+ 			return false;
+@@ -1985,95 +1986,95 @@
+ // deprecated; need a wrapper using octave::typeinfo::register_unary_op
+ #define RSBOI_INSTALL_UNOP INSTALL_UNOP 
+ 
+-static void install_sparsersb_ops (void)
++static void install_sparsersb_ops (octave::type_info& ti)
+ {
+ 	RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);
+ 	#ifdef RSB_FULLY_IMPLEMENTED
+ 	/* boolean pattern-based not */
+-	RSBOI_INSTALL_UNOP (op_not, octave_sparsersb_mtx, op_not);
++	INSTALL_UNOP_TI (ti, op_not, octave_sparsersb_mtx, op_not);
+ 	/* to-dense operations */
+-	RSBOI_INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_scalar, assigns);
++	INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_sparsersb_mtx, octave_scalar, assigns);
+ 	/* ? */
+-	RSBOI_INSTALL_UNOP (op_uplus, octave_sparsersb_mtx, uplus);
++	INSTALL_UNOP_TI (ti, op_uplus, octave_sparsersb_mtx, uplus);
+ 	/* elemental comparison, evaluate to sparse or dense boolean matrices */
+-	RSBOI_INSTALL_BINOP (op_eq, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_le, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_lt, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_ge, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_gt, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_ne, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_eq, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_le, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_lt, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_ge, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_gt, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_ne, octave_sparsersb_mtx, , );
+ 	/* pure elemental; scalar and sparse arguments ?! */
+ 								 // ?
+-	RSBOI_INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_el_ldiv_eq, octave_sparsersb_mtx, , ); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data());
+-	RSBOI_INSTALL_BINOP (op_el_mul_eq, octave_sparsersb_mtx, , ); // diagonal subst ??
+-	RSBOI_INSTALL_BINOP (op_el_and, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_el_or, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_el_ldiv, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_el_ldiv_eq, octave_sparsersb_mtx, , ); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data());
++	INSTALL_BINOP_TI (ti, op_el_mul_eq, octave_sparsersb_mtx, , ); // diagonal subst ??
++	INSTALL_BINOP_TI (ti, op_el_and, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_el_or, octave_sparsersb_mtx, , );
+ 	/* shift operations: they may be left out from the implementation */
+-	RSBOI_INSTALL_BINOP (op_lshift, octave_sparsersb_mtx, , );
+-	RSBOI_INSTALL_BINOP (op_rshift, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_lshift, octave_sparsersb_mtx, , );
++	INSTALL_BINOP_TI (ti, op_rshift, octave_sparsersb_mtx, , );
+ 	#endif
+-	// RSBOI_INSTALL_ASSIGNOP (op_el_div_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_div_eq_sc); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data());
+-	// RSBOI_INSTALL_ASSIGNOP (op_el_mul_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_mul_eq_sc);
++	// INSTALL_ASSIGNOP_TI (ti, op_el_div_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_div_eq_sc); // errval = rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data());
++	// INSTALL_ASSIGNOP_TI (ti, op_el_mul_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_mul_eq_sc);
+ 	//INSTALL_WIDENOP (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_rsb_to_octave_sparse_conv);/* a DEFCONV .. */
+ 	//INSTALL_ASSIGNCONV (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_matrix);/* .. */
+ 	// no need for the following: need a good conversion function, though
+-	//RSBOI_INSTALL_UNOP (op_incr, octave_sparsersb_mtx, op_incr);
+-	//RSBOI_INSTALL_UNOP (op_decr, octave_sparsersb_mtx, op_decr);
+-	RSBOI_INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_scalar, rsb_el_mul_s);
++	//INSTALL_UNOP_TI (ti, op_incr, octave_sparsersb_mtx, op_incr);
++	//INSTALL_UNOP_TI (ti, op_decr, octave_sparsersb_mtx, op_decr);
++	INSTALL_BINOP_TI (ti, op_el_mul, octave_sparsersb_mtx, octave_scalar, rsb_el_mul_s);
+ #if RSBOI_WANT_DOUBLE_COMPLEX
+-	RSBOI_INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_complex, rsb_el_mul_c);
++	INSTALL_BINOP_TI (ti, op_el_mul, octave_sparsersb_mtx, octave_complex, rsb_el_mul_c);
+ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
+-//	RSBOI_INSTALL_ASSIGNOP (op_mul_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_mul_eq_s); // 20110313 not effective
+-//	RSBOI_INSTALL_ASSIGNOP (op_div_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_div_eq_s); // 20110313 not effective
+-	RSBOI_INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_scalar, rsb_el_div_s);
++//	INSTALL_ASSIGNOP_TI (ti, op_mul_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_mul_eq_s); // 20110313 not effective
++//	INSTALL_ASSIGNOP_TI (ti, op_div_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_div_eq_s); // 20110313 not effective
++	INSTALL_BINOP_TI (ti, op_el_div, octave_sparsersb_mtx, octave_scalar, rsb_el_div_s);
+ #if RSBOI_WANT_DOUBLE_COMPLEX
+-	RSBOI_INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_complex, rsb_el_div_c);
++	INSTALL_BINOP_TI (ti, op_el_div, octave_sparsersb_mtx, octave_complex, rsb_el_div_c);
+ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
+-	RSBOI_INSTALL_BINOP (op_el_pow, octave_sparsersb_mtx, octave_scalar, el_pow);
+-	RSBOI_INSTALL_UNOP (op_uminus, octave_sparsersb_mtx, uminus);
+-	RSBOI_INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_matrix, ldiv);
+-	RSBOI_INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, octave_matrix, el_ldiv);
+-	RSBOI_INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_matrix, div);
+-	RSBOI_INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_scalar, rsb_s_div);
++	INSTALL_BINOP_TI (ti, op_el_pow, octave_sparsersb_mtx, octave_scalar, el_pow);
++	INSTALL_UNOP_TI (ti, op_uminus, octave_sparsersb_mtx, uminus);
++	INSTALL_BINOP_TI (ti, op_ldiv, octave_sparsersb_mtx, octave_matrix, ldiv);
++	INSTALL_BINOP_TI (ti, op_el_ldiv, octave_sparsersb_mtx, octave_matrix, el_ldiv);
++	INSTALL_BINOP_TI (ti, op_div, octave_sparsersb_mtx, octave_matrix, div);
++	INSTALL_BINOP_TI (ti, op_div, octave_sparsersb_mtx, octave_scalar, rsb_s_div);
+ #if RSBOI_WANT_DOUBLE_COMPLEX
+-	RSBOI_INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_complex, rsb_c_div);
++	INSTALL_BINOP_TI (ti, op_div, octave_sparsersb_mtx, octave_complex, rsb_c_div);
+ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
+-	RSBOI_INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_scalar, rsb_s_mul);
++	INSTALL_BINOP_TI (ti, op_mul, octave_sparsersb_mtx, octave_scalar, rsb_s_mul);
+ #if RSBOI_WANT_DOUBLE_COMPLEX
+-	RSBOI_INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex, rsb_c_mul);
+-	RSBOI_INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_mul);
+-	RSBOI_INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_trans_mul);
+-	RSBOI_INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_complex_matrix, c_ldiv);
+-	RSBOI_INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_complex_matrix, trans_c_ldiv);
++	INSTALL_BINOP_TI (ti, op_mul, octave_sparsersb_mtx, octave_complex, rsb_c_mul);
++	INSTALL_BINOP_TI (ti, op_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_mul);
++	INSTALL_BINOP_TI (ti, op_trans_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_trans_mul);
++	INSTALL_BINOP_TI (ti, op_ldiv, octave_sparsersb_mtx, octave_complex_matrix, c_ldiv);
++	INSTALL_BINOP_TI (ti, op_trans_ldiv, octave_sparsersb_mtx, octave_complex_matrix, trans_c_ldiv);
+ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
+ #if RSBOI_WANT_POW
+-	RSBOI_INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_scalar, rsb_s_pow);
++	INSTALL_BINOP_TI (ti, op_pow, octave_sparsersb_mtx, octave_scalar, rsb_s_pow);
+ #endif /* RSBOI_WANT_POW */
+-	RSBOI_INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_matrix, el_div);
+-	RSBOI_INSTALL_UNOP (op_transpose, octave_sparsersb_mtx, transpose);
+-	RSBOI_INSTALL_UNOP (op_hermitian, octave_sparsersb_mtx, htranspose);
+-	RSBOI_INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_sparse_matrix, assign);
+-	RSBOI_INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_matrix, assignm);
+-	RSBOI_INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_matrix, op_mul);
+-	//RSBOI_INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_matrix, op_pow);
+-	RSBOI_INSTALL_BINOP (op_sub, octave_sparsersb_mtx, octave_sparsersb_mtx, op_sub);
+-	RSBOI_INSTALL_BINOP (op_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_add);
+-	//RSBOI_INSTALL_BINOP (op_trans_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_trans_add);
+-	RSBOI_INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_sparsersb_mtx, op_spmul);
+-	RSBOI_INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_matrix, op_trans_mul);
+-	RSBOI_INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_matrix, trans_ldiv);
+-	//RSBOI_INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans);
+-	//RSBOI_INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans);
+-	//RSBOI_INSTALL_BINOP (op_herm_mul, octave_sparsersb_mtx, octave_matrix, op_herm_mul);
+-	//RSBOI_INSTALL_BINOP (op_mul_herm, octave_sparsersb_mtx, octave_matrix, op_mul_herm);
+-	//RSBOI_INSTALL_BINOP (op_el_not_and, octave_sparsersb_mtx, octave_matrix, op_el_not_and);
+-	//RSBOI_INSTALL_BINOP (op_el_not_or , octave_sparsersb_mtx, octave_matrix, op_el_not_or );
+-	//RSBOI_INSTALL_BINOP (op_el_and_not, octave_sparsersb_mtx, octave_matrix, op_el_and_not);
+-	//RSBOI_INSTALL_BINOP (op_el_or _not, octave_sparsersb_mtx, octave_matrix, op_el_or _not);
++	INSTALL_BINOP_TI (ti, op_el_div, octave_sparsersb_mtx, octave_matrix, el_div);
++	INSTALL_UNOP_TI (ti, op_transpose, octave_sparsersb_mtx, transpose);
++	INSTALL_UNOP_TI (ti, op_hermitian, octave_sparsersb_mtx, htranspose);
++	INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_sparsersb_mtx, octave_sparse_matrix, assign);
++	INSTALL_ASSIGNOP_TI (ti, op_asn_eq, octave_sparsersb_mtx, octave_matrix, assignm);
++	INSTALL_BINOP_TI (ti, op_mul, octave_sparsersb_mtx, octave_matrix, op_mul);
++	//INSTALL_BINOP_TI (ti, op_pow, octave_sparsersb_mtx, octave_matrix, op_pow);
++	INSTALL_BINOP_TI (ti, op_sub, octave_sparsersb_mtx, octave_sparsersb_mtx, op_sub);
++	INSTALL_BINOP_TI (ti, op_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_add);
++	//INSTALL_BINOP_TI (ti, op_trans_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_trans_add);
++	INSTALL_BINOP_TI (ti, op_mul, octave_sparsersb_mtx, octave_sparsersb_mtx, op_spmul);
++	INSTALL_BINOP_TI (ti, op_trans_mul, octave_sparsersb_mtx, octave_matrix, op_trans_mul);
++	INSTALL_BINOP_TI (ti, op_trans_ldiv, octave_sparsersb_mtx, octave_matrix, trans_ldiv);
++	//INSTALL_BINOP_TI (ti, op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans);
++	//INSTALL_BINOP_TI (ti, op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans);
++	//INSTALL_BINOP_TI (ti, op_herm_mul, octave_sparsersb_mtx, octave_matrix, op_herm_mul);
++	//INSTALL_BINOP_TI (ti, op_mul_herm, octave_sparsersb_mtx, octave_matrix, op_mul_herm);
++	//INSTALL_BINOP_TI (ti, op_el_not_and, octave_sparsersb_mtx, octave_matrix, op_el_not_and);
++	//INSTALL_BINOP_TI (ti, op_el_not_or , octave_sparsersb_mtx, octave_matrix, op_el_not_or );
++	//INSTALL_BINOP_TI (ti, op_el_and_not, octave_sparsersb_mtx, octave_matrix, op_el_and_not);
++	//INSTALL_BINOP_TI (ti, op_el_or _not, octave_sparsersb_mtx, octave_matrix, op_el_or _not);
+ }
+ 
+-static void install_sparse_rsb (void)
++static void install_sparse_rsb (octave::interpreter& interp)
+ {
+ 	static bool rsboi_initialized = false;
+ 
+@@ -2103,16 +2104,17 @@
+ 	if (!rsboi_sparse_rsb_loaded)
+ 	{
+ 		octave_sparsersb_mtx::register_type ();
+-		install_sparsersb_ops ();
++		interp.mlock ();
++		octave::type_info& ti = interp.get_type_info ();
++		install_sparsersb_ops (ti);
+ 		rsboi_sparse_rsb_loaded = true;
+-		mlock();
+ 	}
+ 	return;
+ err:
+ 	RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS
+ }
+ 
+-DEFUN_DLD (RSB_SPARSERSB_LABEL, args, nargout,
++DEFMETHOD_DLD (RSB_SPARSERSB_LABEL, interp, args, nargout,
+ "-*- texinfo -*-\n\
+ @deftypefn {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{a})\n\
+ @deftypefnx {Loadable Function} {@var{S} =} " RSBOI_FNS " (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n})\n\
+@@ -2228,7 +2230,7 @@
+ #else /* RSBOI_WANT_DOUBLE_COMPLEX */
+ 		RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG);
+ #endif /* RSBOI_WANT_DOUBLE_COMPLEX */
+-	install_sparse_rsb();
++	install_sparse_rsb (interp);
+ 	if( nargin == 3 && args(0).is_string() && args(0).string_value()=="set" && args(1).is_string() && args(2).is_string())
+ 	{
+ 		// sparsersb ("set", OPN, OPV)