changeset 10785:c2041adcf234

remove unnecessary sparse indexing overloads
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 13 Jul 2010 12:08:08 +0200
parents ca2df6737d6b
children 146a97c3bc97
files liboctave/CSparse.cc liboctave/CSparse.h liboctave/ChangeLog liboctave/MSparse.h liboctave/dSparse.cc liboctave/dSparse.h src/ChangeLog src/data.cc
diffstat 8 files changed, 14 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CSparse.cc
+++ b/liboctave/CSparse.cc
@@ -7180,18 +7180,6 @@
 }
 
 SparseComplexMatrix
-SparseComplexMatrix::index (const idx_vector& i, bool resize_ok) const 
-{ 
-  return MSparse<Complex>::index (i, resize_ok); 
-}
-
-SparseComplexMatrix
-SparseComplexMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const 
-{ 
-  return MSparse<Complex>::index (i, j, resize_ok); 
-}
-  
-SparseComplexMatrix
 SparseComplexMatrix::reshape (const dim_vector& new_dims) const
 {
   return MSparse<Complex>::reshape (new_dims);
--- a/liboctave/CSparse.h
+++ b/liboctave/CSparse.h
@@ -395,10 +395,6 @@
 
   SparseComplexMatrix squeeze (void) const;
 
-  SparseComplexMatrix index (const idx_vector& i, bool resize_ok) const;
-
-  SparseComplexMatrix index (const idx_vector& i, const idx_vector& j, bool resize_ok) const;
-
   SparseComplexMatrix reshape (const dim_vector& new_dims) const;
 
   SparseComplexMatrix permute (const Array<octave_idx_type>& vec, 
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,11 @@
+2010-07-13  Jaroslav Hajek  <highegg@gmail.com>
+
+	* MSparse.h (MSparse<T>::index): Remove overloads.
+	* dSparse.h (SparseMatrix::index): Likewise.
+	* dSparse.cc (SparseMatrix::index): Likewise.
+	* CSparse.h (SparseComplexMatrix::index): Likewise.
+	* CSparse.cc (SparseComplexMatrix::index): Likewise.
+
 2010-07-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* CMatrix.cc (ComplexMatrix::lssolve (const ComplexMatrix&)):
--- a/liboctave/MSparse.h
+++ b/liboctave/MSparse.h
@@ -91,12 +91,6 @@
 
   MSparse<T> squeeze (void) const { return Sparse<T>::squeeze (); }
 
-  MSparse<T> index (const idx_vector& i, bool resize_ok) const 
-    { return Sparse<T>::index (i, resize_ok); }
-
-  MSparse<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok) const 
-    { return Sparse<T>::index (i, j, resize_ok); }
-  
   MSparse<T> reshape (const dim_vector& new_dims) const
     { return Sparse<T>::reshape (new_dims); }
      
--- a/liboctave/dSparse.cc
+++ b/liboctave/dSparse.cc
@@ -7594,18 +7594,6 @@
 }
 
 SparseMatrix
-SparseMatrix::index (const idx_vector& i, bool resize_ok) const 
-{ 
-  return MSparse<double>::index (i, resize_ok); 
-}
-
-SparseMatrix
-SparseMatrix::index (const idx_vector& i, const idx_vector& j, bool resize_ok) const 
-{ 
-  return MSparse<double>::index (i, j, resize_ok); 
-}
-  
-SparseMatrix
 SparseMatrix::reshape (const dim_vector& new_dims) const
 {
   return MSparse<double>::reshape (new_dims);
--- a/liboctave/dSparse.h
+++ b/liboctave/dSparse.h
@@ -406,10 +406,6 @@
 
   SparseMatrix squeeze (void) const;
 
-  SparseMatrix index (const idx_vector& i, bool resize_ok) const;
-
-  SparseMatrix index (const idx_vector& i, const idx_vector& j, bool resize_ok) const;
-
   SparseMatrix reshape (const dim_vector& new_dims) const;
 
   SparseMatrix permute (const Array<octave_idx_type>& vec, bool inv = false) const;
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-13  Jaroslav Hajek  <highegg@gmail.com>
+
+	* data.cc (do_sparse_diff): Use typecasts where needed.
+
 2010-07-12  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/rand.cc (do_rand): Pass the distribution name as an
--- a/src/data.cc
+++ b/src/data.cc
@@ -6299,7 +6299,7 @@
       while (order > 0 && k > 0)
         {
           idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1);
-          retval = retval.index (col1, sl1, 0) - retval.index (col2, sl2, 0);
+          retval = SparseT (retval.index (col1, sl1)) - SparseT (retval.index (col2, sl2));
           assert (retval.columns () == k-1);
           order--;
           k--;
@@ -6311,7 +6311,7 @@
       while (order > 0 && k > 0)
         {
           idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1);
-          retval = retval.index (sl1, col1, 0) - retval.index (sl2, col2, 0);
+          retval = SparseT (retval.index (sl1, col1)) - SparseT (retval.index (sl2, col2));
           assert (retval.rows () == k-1);
           order--;
           k--;