changeset 23593:a8361bc2361a

maint: Deprecate is_square and replace with issquare. * Array.h (is_square): Use OCTAVE_DEPRECATED macro around function. * Array.h (issquare): New function. * Sparse.h (is_square): Use OCTAVE_DEPRECATED macro around function. * Sparse.h (issquare): New function. * lu.cc, qr.cc, CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc, chol.cc, qr.cc: Replace instances of is_square with issquare.
author Rik <rik@octave.org>
date Tue, 13 Jun 2017 22:05:03 -0700
parents 80e3bfb7bd5a
children af5b813503cb
files libinterp/corefcn/lu.cc libinterp/dldfcn/qr.cc liboctave/array/Array.h liboctave/array/CMatrix.cc liboctave/array/Sparse.h liboctave/array/dMatrix.cc liboctave/array/fCMatrix.cc liboctave/array/fMatrix.cc liboctave/numeric/chol.cc liboctave/numeric/qr.cc
diffstat 10 files changed, 30 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/lu.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/libinterp/corefcn/lu.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -39,7 +39,7 @@
 get_lu_l (const octave::math::lu<MT>& fact)
 {
   MT L = fact.L ();
-  if (L.is_square ())
+  if (L.issquare ())
     return octave_value (L, MatrixType (MatrixType::Lower));
   else
     return L;
@@ -50,7 +50,7 @@
 get_lu_u (const octave::math::lu<MT>& fact)
 {
   MT U = fact.U ();
-  if (U.is_square () && fact.regular ())
+  if (U.issquare () && fact.regular ())
     return octave_value (U, MatrixType (MatrixType::Upper));
   else
     return U;
--- a/libinterp/dldfcn/qr.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/libinterp/dldfcn/qr.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -45,7 +45,7 @@
 get_qr_r (const octave::math::qr<MT>& fact)
 {
   MT R = fact.R ();
-  if (R.is_square () && fact.regular ())
+  if (R.issquare () && fact.regular ())
     return octave_value (R, MatrixType (MatrixType::Upper));
   else
     return R;
--- a/liboctave/array/Array.h	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/Array.h	Tue Jun 13 22:05:03 2017 -0700
@@ -556,7 +556,11 @@
   Array<T> ipermute (const Array<octave_idx_type>& vec) const
   { return permute (vec, true); }
 
-  bool is_square (void) const { return (dim1 () == dim2 ()); }
+  bool issquare (void) const { return (dim1 () == dim2 ()); }
+
+  OCTAVE_DEPRECATED ("use 'issquare' instead")
+  bool is_square (void) const
+  { return issquare (); }
 
   bool isempty (void) const { return numel () == 0; }
 
--- a/liboctave/array/CMatrix.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/CMatrix.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -175,7 +175,7 @@
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
-  if (is_square () && nr > 0)
+  if (issquare () && nr > 0)
     {
       for (octave_idx_type i = 0; i < nr; i++)
         for (octave_idx_type j = i; j < nc; j++)
--- a/liboctave/array/Sparse.h	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/Sparse.h	Tue Jun 13 22:05:03 2017 -0700
@@ -467,7 +467,11 @@
   Sparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c);
   Sparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& idx);
 
-  bool is_square (void) const { return (dim1 () == dim2 ()); }
+  bool issquare (void) const { return (dim1 () == dim2 ()); }
+
+  OCTAVE_DEPRECATED ("use 'issquare' instead")
+  bool is_square (void) const
+  { return issquare (); }
 
   bool isempty (void) const { return (rows () < 1 && cols () < 1); }
 
--- a/liboctave/array/dMatrix.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/dMatrix.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -134,7 +134,7 @@
 bool
 Matrix::is_symmetric (void) const
 {
-  if (is_square () && rows () > 0)
+  if (issquare () && rows () > 0)
     {
       for (octave_idx_type i = 0; i < rows (); i++)
         for (octave_idx_type j = i+1; j < cols (); j++)
--- a/liboctave/array/fCMatrix.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/fCMatrix.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -175,7 +175,7 @@
   octave_idx_type nr = rows ();
   octave_idx_type nc = cols ();
 
-  if (is_square () && nr > 0)
+  if (issquare () && nr > 0)
     {
       for (octave_idx_type i = 0; i < nr; i++)
         for (octave_idx_type j = i; j < nc; j++)
--- a/liboctave/array/fMatrix.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/array/fMatrix.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -136,7 +136,7 @@
 bool
 FloatMatrix::is_symmetric (void) const
 {
-  if (is_square () && rows () > 0)
+  if (issquare () && rows () > 0)
     {
       for (octave_idx_type i = 0; i < rows (); i++)
         for (octave_idx_type j = i+1; j < cols (); j++)
--- a/liboctave/numeric/chol.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/numeric/chol.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -256,7 +256,7 @@
     void
     chol<T>::set (const T& R)
     {
-      if (! R.is_square ())
+      if (! R.issquare ())
         (*current_liboctave_error_handler) ("chol: requires square matrix");
 
       chol_mat = R;
--- a/liboctave/numeric/qr.cc	Tue Jun 13 20:51:14 2017 -0700
+++ b/liboctave/numeric/qr.cc	Tue Jun 13 22:05:03 2017 -0700
@@ -73,9 +73,9 @@
     {
       type retval;
 
-      if (! q.isempty () && q.is_square ())
+      if (! q.isempty () && q.issquare ())
         retval = qr<T>::std;
-      else if (q.rows () > q.cols () && r.is_square ())
+      else if (q.rows () > q.cols () && r.issquare ())
         retval = qr<T>::economy;
       else
         retval = qr<T>::raw;
@@ -332,7 +332,7 @@
       octave_idx_type m = r.rows ();
       octave_idx_type n = r.cols ();
 
-      if (! q.is_square () || u.numel () != n)
+      if (! q.issquare () || u.numel () != n)
         (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
 
       if (j < 0 || j > m)
@@ -349,7 +349,7 @@
 
       octave_idx_type m = r.rows ();
 
-      if (! q.is_square ())
+      if (! q.issquare ())
         (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
 
       if (j < 0 || j > m-1)
@@ -718,7 +718,7 @@
 
       F77_INT u_nel = octave::to_f77_int (u.numel ());
 
-      if (! q.is_square () || u_nel != n)
+      if (! q.issquare () || u_nel != n)
         (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
 
       if (j < 0 || j > m)
@@ -747,7 +747,7 @@
       F77_INT m = octave::to_f77_int (r.rows ());
       F77_INT n = octave::to_f77_int (r.cols ());
 
-      if (! q.is_square ())
+      if (! q.issquare ())
         (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
 
       if (j < 0 || j > m-1)
@@ -1135,7 +1135,7 @@
 
       F77_INT u_nel = octave::to_f77_int (u.numel ());
 
-      if (! q.is_square () || u_nel != n)
+      if (! q.issquare () || u_nel != n)
         (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
 
       if (j < 0 || j > m)
@@ -1164,7 +1164,7 @@
       F77_INT m = octave::to_f77_int (r.rows ());
       F77_INT n = octave::to_f77_int (r.cols ());
 
-      if (! q.is_square ())
+      if (! q.issquare ())
         (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
 
       if (j < 0 || j > m-1)
@@ -1577,7 +1577,7 @@
 
       F77_INT u_nel = octave::to_f77_int (u.numel ());
 
-      if (! q.is_square () || u_nel != n)
+      if (! q.issquare () || u_nel != n)
         (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
 
       if (j < 0 || j > m)
@@ -1607,7 +1607,7 @@
       F77_INT m = octave::to_f77_int (r.rows ());
       F77_INT n = octave::to_f77_int (r.cols ());
 
-      if (! q.is_square ())
+      if (! q.issquare ())
         (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
 
       if (j < 0 || j > m-1)
@@ -2015,7 +2015,7 @@
 
       F77_INT u_nel = octave::to_f77_int (u.numel ());
 
-      if (! q.is_square () || u_nel != n)
+      if (! q.issquare () || u_nel != n)
         (*current_liboctave_error_handler) ("qrinsert: dimensions mismatch");
 
       if (j < 0 || j > m)
@@ -2045,7 +2045,7 @@
       F77_INT m = octave::to_f77_int (r.rows ());
       F77_INT n = octave::to_f77_int (r.cols ());
 
-      if (! q.is_square ())
+      if (! q.issquare ())
         (*current_liboctave_error_handler) ("qrdelete: dimensions mismatch");
 
       if (j < 0 || j > m-1)