changeset 29990:b839c36fd106

move sparse xdiv and xpow operator functions inside octave namespace * sparse-xdiv.h, sparse-xdiv.cc (elem_xdiv): Rename from x_el_div. (elem_xdiv, xdiv): Move inside octave namespace. Change all uses. Provide deprecated wrapper functions to preserve old names. * sparse-xpow.h, sparse-xpow.cc (elem_xpow, xpow): Move inside octave namespace. Change all uses. Provide deprecated wrapper functions to preserve old names.
author John W. Eaton <jwe@octave.org>
date Mon, 16 Aug 2021 22:28:30 -0400
parents b260322f6730
children 3988112c7116
files libinterp/corefcn/sparse-xdiv.cc libinterp/corefcn/sparse-xdiv.h libinterp/corefcn/sparse-xpow.cc libinterp/corefcn/sparse-xpow.h libinterp/operators/op-cs-scm.cc libinterp/operators/op-cs-sm.cc libinterp/operators/op-s-scm.cc libinterp/operators/op-s-sm.cc libinterp/operators/op-scm-cs.cc libinterp/operators/op-scm-s.cc libinterp/operators/op-sm-cs.cc libinterp/operators/op-sm-s.cc
diffstat 12 files changed, 336 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sparse-xdiv.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/corefcn/sparse-xdiv.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -43,6 +43,8 @@
 #include "oct-spparms.h"
 #include "sparse-xdiv.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 static void
 solve_singularity_warning (double rcond)
 {
@@ -370,7 +372,7 @@
 //                  +---+----+
 
 Matrix
-x_el_div (double a, const SparseMatrix& b)
+elem_xdiv (double a, const SparseMatrix& b)
 {
   octave_idx_type nr = b.rows ();
   octave_idx_type nc = b.cols ();
@@ -394,7 +396,7 @@
 }
 
 ComplexMatrix
-x_el_div (double a, const SparseComplexMatrix& b)
+elem_xdiv (double a, const SparseComplexMatrix& b)
 {
   octave_idx_type nr = b.rows ();
   octave_idx_type nc = b.cols ();
@@ -413,7 +415,7 @@
 }
 
 ComplexMatrix
-x_el_div (const Complex a, const SparseMatrix& b)
+elem_xdiv (const Complex& a, const SparseMatrix& b)
 {
   octave_idx_type nr = b.rows ();
   octave_idx_type nc = b.cols ();
@@ -431,7 +433,7 @@
 }
 
 ComplexMatrix
-x_el_div (const Complex a, const SparseComplexMatrix& b)
+elem_xdiv (const Complex& a, const SparseComplexMatrix& b)
 {
   octave_idx_type nr = b.rows ();
   octave_idx_type nc = b.cols ();
@@ -633,3 +635,5 @@
 {
   return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a);
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/sparse-xdiv.h	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/corefcn/sparse-xdiv.h	Mon Aug 16 22:28:30 2021 -0400
@@ -36,6 +36,8 @@
 class SparseMatrix;
 class SparseComplexMatrix;
 
+OCTAVE_NAMESPACE_BEGIN
+
 extern Matrix xdiv (const Matrix& a, const SparseMatrix& b, MatrixType& typ);
 extern ComplexMatrix xdiv (const Matrix& a, const SparseComplexMatrix& b,
                            MatrixType& typ);
@@ -62,11 +64,11 @@
 extern SparseComplexMatrix xdiv (const SparseComplexMatrix& a,
                                  const ComplexDiagMatrix& b, MatrixType& typ);
 
-extern Matrix x_el_div (double a, const SparseMatrix& b);
-extern ComplexMatrix x_el_div (double a, const SparseComplexMatrix& b);
-extern ComplexMatrix x_el_div (const Complex a, const SparseMatrix& b);
-extern ComplexMatrix x_el_div (const Complex a,
-                               const SparseComplexMatrix& b);
+extern Matrix elem_xdiv (double a, const SparseMatrix& b);
+extern ComplexMatrix elem_xdiv (double a, const SparseComplexMatrix& b);
+extern ComplexMatrix elem_xdiv (const Complex& a, const SparseMatrix& b);
+extern ComplexMatrix elem_xdiv (const Complex& a,
+                                const SparseComplexMatrix& b);
 
 extern Matrix xleftdiv (const SparseMatrix& a, const Matrix& b,
                         MatrixType& typ);
@@ -100,4 +102,206 @@
                                      const SparseComplexMatrix&,
                                      MatrixType&);
 
+OCTAVE_NAMESPACE_END
+
+#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline Matrix
+xdiv (const Matrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline ComplexMatrix
+xdiv (const Matrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline ComplexMatrix
+xdiv (const ComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline ComplexMatrix
+xdiv (const ComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseMatrix
+xdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseMatrix
+xdiv (const SparseMatrix& a, const DiagMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseMatrix& a, const ComplexDiagMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseComplexMatrix& a, const DiagMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xdiv' instead")
+inline SparseComplexMatrix
+xdiv (const SparseComplexMatrix& a, const ComplexDiagMatrix& b, MatrixType& typ)
+{
+  return octave::xdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
+inline Matrix
+x_el_div (double a, const SparseMatrix& b)
+{
+  return octave::elem_xdiv (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
+inline ComplexMatrix
+x_el_div (double a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xdiv (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
+inline ComplexMatrix
+x_el_div (const Complex& a, const SparseMatrix& b)
+{
+  return octave::elem_xdiv (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xdiv' instead")
+inline ComplexMatrix
+x_el_div (const Complex& a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xdiv (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline Matrix
+xleftdiv (const SparseMatrix& a, const Matrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline ComplexMatrix
+xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline ComplexMatrix
+xleftdiv (const SparseComplexMatrix& a, const Matrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline ComplexMatrix
+xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseMatrix
+xleftdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseMatrix
+xleftdiv (const DiagMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const ComplexDiagMatrix& a, const SparseMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const DiagMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xleftdiv' instead")
+inline SparseComplexMatrix
+xleftdiv (const ComplexDiagMatrix& a, const SparseComplexMatrix& b, MatrixType& typ)
+{
+  return octave::xleftdiv (a, b, typ);
+}
+
 #endif
+
+#endif
--- a/libinterp/corefcn/sparse-xpow.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/corefcn/sparse-xpow.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -45,6 +45,8 @@
 #include "ov-cx-sparse.h"
 #include "sparse-xpow.h"
 
+OCTAVE_NAMESPACE_BEGIN
+
 static inline int
 xisint (double x)
 {
@@ -743,3 +745,5 @@
 
   return result;
 }
+
+OCTAVE_NAMESPACE_END
--- a/libinterp/corefcn/sparse-xpow.h	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/corefcn/sparse-xpow.h	Mon Aug 16 22:28:30 2021 -0400
@@ -34,6 +34,8 @@
 class SparseComplexMatrix;
 class octave_value;
 
+OCTAVE_NAMESPACE_BEGIN
+
 extern octave_value xpow (const SparseMatrix& a, double b);
 extern octave_value xpow (const SparseComplexMatrix& a, double b);
 
@@ -58,4 +60,108 @@
 extern octave_value elem_xpow (const SparseComplexMatrix& a,
                                const SparseComplexMatrix& b);
 
+OCTAVE_NAMESPACE_END
+
+#if (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
+
+OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
+inline octave_value
+xpow (const SparseMatrix& a, double b)
+{
+  return octave::xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::xpow' instead")
+inline octave_value
+xpow (const SparseComplexMatrix& a, double b)
+{
+  return octave::xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (double a, const SparseMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (double a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseMatrix& a, double b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseMatrix& a, const SparseMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseMatrix& a, const Complex& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseMatrix& a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const Complex& a, const SparseMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const Complex& a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseComplexMatrix& a, double b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseComplexMatrix& a, const SparseMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseComplexMatrix& a, const Complex& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
+OCTAVE_DEPRECATED (7, "use 'octave::elem_xpow' instead")
+inline octave_value
+elem_xpow (const SparseComplexMatrix& a, const SparseComplexMatrix& b)
+{
+  return octave::elem_xpow (a, b);
+}
+
 #endif
+
+#endif
--- a/libinterp/operators/op-cs-scm.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-cs-scm.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -92,7 +92,7 @@
 DEFBINOP_FN (ne, complex, sparse_complex_matrix, mx_el_ne)
 
 DEFBINOP_OP (el_mul, complex, sparse_complex_matrix, *)
-DEFBINOP_FN (el_div, complex, sparse_complex_matrix, x_el_div)
+DEFBINOP_FN (el_div, complex, sparse_complex_matrix, elem_xdiv)
 
 DEFBINOP_FN (el_pow, complex, sparse_complex_matrix, elem_xpow)
 
--- a/libinterp/operators/op-cs-sm.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-cs-sm.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -90,7 +90,7 @@
 DEFBINOP_FN (ne, complex, sparse_matrix, mx_el_ne)
 
 DEFBINOP_OP (el_mul, complex, sparse_matrix, *)
-DEFBINOP_FN (el_div, complex, sparse_matrix, x_el_div)
+DEFBINOP_FN (el_div, complex, sparse_matrix, elem_xdiv)
 DEFBINOP_FN (el_pow, complex, sparse_matrix, elem_xpow)
 
 DEFBINOP (el_ldiv, complex, sparse_matrix)
--- a/libinterp/operators/op-s-scm.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-s-scm.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -95,7 +95,7 @@
 DEFBINOP_FN (ne, scalar, sparse_complex_matrix, mx_el_ne)
 
 DEFBINOP_OP (el_mul, scalar, sparse_complex_matrix, *)
-DEFBINOP_FN (el_div, scalar, sparse_complex_matrix, x_el_div)
+DEFBINOP_FN (el_div, scalar, sparse_complex_matrix, elem_xdiv)
 DEFBINOP_FN (el_pow, scalar, sparse_complex_matrix, elem_xpow)
 
 DEFBINOP (el_ldiv, scalar, sparse_complex_matrix)
--- a/libinterp/operators/op-s-sm.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-s-sm.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -87,7 +87,7 @@
 DEFBINOP_FN (ne, scalar, sparse_matrix, mx_el_ne)
 
 DEFBINOP_OP (el_mul, scalar, sparse_matrix, *)
-DEFBINOP_FN (el_div, scalar, sparse_matrix, x_el_div)
+DEFBINOP_FN (el_div, scalar, sparse_matrix, elem_xdiv)
 DEFBINOP_FN (el_pow, scalar, sparse_matrix, elem_xpow)
 
 DEFBINOP (el_ldiv, scalar, sparse_matrix)
--- a/libinterp/operators/op-scm-cs.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-scm-cs.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -112,7 +112,7 @@
   const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2);
 
   return octave_value
-         (x_el_div (v2.complex_value (), v1.sparse_complex_matrix_value ()));
+         (elem_xdiv (v2.complex_value (), v1.sparse_complex_matrix_value ()));
 }
 
 DEFBINOP_FN (el_and, sparse_complex_matrix, complex, mx_el_and)
--- a/libinterp/operators/op-scm-s.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-scm-s.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -120,7 +120,7 @@
   const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2);
 
   return octave_value
-         (x_el_div (v2.double_value (), v1.sparse_complex_matrix_value ()));
+         (elem_xdiv (v2.double_value (), v1.sparse_complex_matrix_value ()));
 }
 
 DEFBINOP_FN (el_and, sparse_complex_matrix, scalar, mx_el_and)
--- a/libinterp/operators/op-sm-cs.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-sm-cs.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -108,8 +108,8 @@
   const octave_sparse_matrix& v1 = dynamic_cast<const octave_sparse_matrix&> (a1);
   const octave_complex& v2 = dynamic_cast<const octave_complex&> (a2);
 
-  return octave_value (x_el_div (v2.complex_value (),
-                                 v1.sparse_matrix_value ()));
+  return octave_value (elem_xdiv (v2.complex_value (),
+                                  v1.sparse_matrix_value ()));
 }
 
 DEFBINOP_FN (el_and, sparse_matrix, complex, mx_el_and)
--- a/libinterp/operators/op-sm-s.cc	Mon Aug 16 21:38:22 2021 -0400
+++ b/libinterp/operators/op-sm-s.cc	Mon Aug 16 22:28:30 2021 -0400
@@ -110,7 +110,7 @@
   const octave_scalar& v2 = dynamic_cast<const octave_scalar&> (a2);
 
   return octave_value
-         (x_el_div (v2.complex_value (), v1.sparse_matrix_value ()));
+         (elem_xdiv (v2.complex_value (), v1.sparse_matrix_value ()));
 }
 
 DEFBINOP_FN (el_and, sparse_matrix, scalar, mx_el_and)