changeset 10480:19e1e4470e01

remove old sparse assembly ctors
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 31 Mar 2010 10:24:57 +0200
parents ded9beac7582
children e8811e5dd699
files liboctave/CSparse.h liboctave/ChangeLog liboctave/MSparse.h liboctave/Sparse.cc liboctave/Sparse.h liboctave/boolSparse.h liboctave/dSparse.h
diffstat 7 files changed, 12 insertions(+), 283 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CSparse.h	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/CSparse.h	Wed Mar 31 10:24:57 2010 +0200
@@ -78,17 +78,6 @@
   explicit SparseComplexMatrix (const ComplexNDArray& a) 
     : MSparse<Complex> (a) { }
 
-  explicit SparseComplexMatrix (const Array<Complex> a, const Array<octave_idx_type>& r, 
-                         const Array<octave_idx_type>& c, octave_idx_type nr = -1, 
-                         octave_idx_type nc = -1, bool sum_terms = true)
-    : MSparse<Complex> (a, r, c, nr, nc, sum_terms) { }
-
-  explicit SparseComplexMatrix (const Array<Complex> a, 
-                                const Array<double>& r, 
-                                const Array<double>& c, octave_idx_type nr = -1, 
-                                octave_idx_type nc = -1, bool sum_terms = true)
-    : MSparse<Complex> (a, r, c, nr, nc, sum_terms) { }
-
   SparseComplexMatrix (const Array<Complex>& a, const idx_vector& r, 
                        const idx_vector& c, octave_idx_type nr = -1, 
                        octave_idx_type nc = -1, bool sum_terms = true)
--- a/liboctave/ChangeLog	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/ChangeLog	Wed Mar 31 10:24:57 2010 +0200
@@ -1,3 +1,15 @@
+2010-03-31  Jaroslav Hajek  <highegg@gmail.com>
+
+	* Sparse.cc (Sparse<T>::Sparse (const Array<T>&,
+	const Array<octave_idx_type>&, ...), Sparse<T>::Sparse (const Array<T>&,
+	const Array<double>&, ...)):
+	Remove old constructors.
+	* Sparse.h: Ditto.
+	* MSparse.h: Ditto.
+	* dSparse.h: Ditto.
+	* CSparse.h: Ditto.
+	* boolSparse.h: Ditto.
+
 2010-03-31  Jaroslav Hajek  <highegg@gmail.com>
 
 	* idx-vector.cc (idx_vector::idx_range_rep::as_array): Fix typo.
--- a/liboctave/MSparse.h	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/MSparse.h	Wed Mar 31 10:24:57 2010 +0200
@@ -55,16 +55,6 @@
 
   MSparse (const Sparse<T>& a) : Sparse<T> (a) { }
 
-  MSparse (const Array<T> a, const Array<octave_idx_type>& r, 
-           const Array<octave_idx_type>& c, octave_idx_type nr = -1, 
-           octave_idx_type nc = -1, bool sum_terms = true)
-    : Sparse<T> (a, r, c, nr, nc, sum_terms) { }
-
-  MSparse (const Array<T> a, const Array<double>& r, 
-           const Array<double>& c, octave_idx_type nr = -1, 
-           octave_idx_type nc = -1, bool sum_terms = true)
-    : Sparse<T> (a, r, c, nr, nc, sum_terms) { }
-
   MSparse (const Array<T>& a, const idx_vector& r, const idx_vector& c,
            octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true)
     : Sparse<T> (a, r, c, nr, nc, sum_terms) { }
--- a/liboctave/Sparse.cc	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/Sparse.cc	Wed Mar 31 10:24:57 2010 +0200
@@ -316,242 +316,6 @@
 }
 
 template <class T>
-Sparse<T>::Sparse (const Array<T>& a, const Array<octave_idx_type>& r, 
-                   const Array<octave_idx_type>& c, octave_idx_type nr,
-                   octave_idx_type nc, bool sum_terms)
-  : dimensions (dim_vector (nr, nc)), idx (0), idx_count (0)
-{
-  octave_idx_type a_len = a.length ();
-  octave_idx_type r_len = r.length ();
-  octave_idx_type c_len = c.length ();
-  bool ri_scalar = (r_len == 1); 
-  bool ci_scalar = (c_len == 1);
-  bool cf_scalar = (a_len == 1);
-  
-  if ((a_len != r_len && !cf_scalar && !ri_scalar) ||
-      (a_len != c_len && !cf_scalar && !ci_scalar) ||
-      (r_len != c_len && !ri_scalar && !ci_scalar) || nr < 0 || nc < 0)
-    {
-      (*current_liboctave_error_handler)
-        ("Sparse::Sparse (const Array<T>&, const Array<octave_idx_type>&, ...): dimension mismatch");
-      rep = nil_rep ();
-      dimensions = dim_vector (0, 0);
-    }
-  else
-    {
-      octave_idx_type max_nzmx = (r_len > c_len ? r_len : c_len);
-
-      OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl *, sidx, max_nzmx);
-      OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl, sidxX, max_nzmx);
-
-      for (octave_idx_type i = 0; i < max_nzmx; i++)
-        sidx[i] = &sidxX[i];
-
-      octave_idx_type actual_nzmx = 0;
-      octave_quit ();
-      for (octave_idx_type i = 0; i < max_nzmx; i++) 
-        {
-          octave_idx_type rowidx =  (ri_scalar ? r(0) : r(i));
-          octave_idx_type colidx = (ci_scalar ? c(0) : c(i));
-          if (rowidx < nr && rowidx >= 0 &&
-              colidx < nc && colidx >= 0 ) 
-            {
-              if ( a (cf_scalar ? 0 : i ) != T ()) 
-                {
-                  sidx[actual_nzmx]->r = rowidx;
-                  sidx[actual_nzmx]->c = colidx;
-                  sidx[actual_nzmx]->idx = i;
-                  actual_nzmx++;        
-                }
-            }
-          else 
-            {
-              (*current_liboctave_error_handler)
-                ("Sparse::Sparse : index (%d,%d) out of range", 
-                 rowidx + 1, colidx + 1);
-              rep = nil_rep ();
-              dimensions = dim_vector (0, 0);
-              return;
-            }
-        }
-  
-      if (actual_nzmx == 0)
-        rep = new typename Sparse<T>::SparseRep (nr, nc);
-      else
-        {
-          octave_quit ();
-          octave_sort<octave_sparse_sort_idxl *> 
-            lsort (octave_sparse_sidxl_comp);
-
-          lsort.sort (sidx, actual_nzmx);
-          octave_quit ();
-
-          // Now count the unique non-zero values
-          octave_idx_type real_nzmx = 1;
-          for (octave_idx_type i = 1; i < actual_nzmx; i++) 
-            if (sidx[i-1]->r != sidx[i]->r || sidx[i-1]->c != sidx[i]->c) 
-              real_nzmx++;
-
-          rep = new typename Sparse<T>::SparseRep (nr, nc, real_nzmx);
-
-          octave_idx_type cx = 0;
-          octave_idx_type prev_rval = -1;
-          octave_idx_type prev_cval = -1;
-          octave_idx_type ii = -1;
-          xcidx (0) = 0;
-          for (octave_idx_type i = 0; i < actual_nzmx; i++) 
-            {
-              octave_quit ();
-              octave_idx_type iidx = sidx[i]->idx;
-              octave_idx_type rval = sidx[i]->r;
-              octave_idx_type cval = sidx[i]->c;
-
-              if (prev_cval < cval || (prev_rval < rval && prev_cval == cval)) 
-                {
-                  octave_idx_type ci = static_cast<octave_idx_type> (c (ci_scalar ? 0 : iidx));
-                  ii++;
-                  while (cx < ci) 
-                    xcidx (++cx) = ii;
-                  xdata(ii) = a (cf_scalar ? 0 : iidx);
-                  xridx(ii) = static_cast<octave_idx_type> (r (ri_scalar ? 0 : iidx));
-                } 
-              else 
-                {
-                  if (sum_terms)
-                    xdata(ii) += a (cf_scalar ? 0 : iidx);
-                  else
-                    xdata(ii) =  a (cf_scalar ? 0 : iidx);
-                }
-              prev_rval = rval;
-              prev_cval = cval;
-            } 
-
-          while (cx < nc) 
-            xcidx (++cx) = ii + 1;
-        }
-    }
-}
-
-template <class T>
-Sparse<T>::Sparse (const Array<T>& a, const Array<double>& r, 
-                   const Array<double>& c, octave_idx_type nr,
-                   octave_idx_type nc, bool sum_terms)
-  : dimensions (dim_vector (nr, nc)), idx (0), idx_count (0)
-{
-  octave_idx_type a_len = a.length ();
-  octave_idx_type r_len = r.length ();
-  octave_idx_type c_len = c.length ();
-  bool ri_scalar = (r_len == 1); 
-  bool ci_scalar = (c_len == 1);
-  bool cf_scalar = (a_len == 1);
-
-  if ((a_len != r_len && !cf_scalar && !ri_scalar) ||
-      (a_len != c_len && !cf_scalar && !ci_scalar) ||
-      (r_len != c_len && !ri_scalar && !ci_scalar) || nr < 0 || nc < 0)
-    {
-      (*current_liboctave_error_handler)
-        ("Sparse::Sparse (const Array<T>&, const Array<double>&, ...): dimension mismatch");
-      rep = nil_rep ();
-      dimensions = dim_vector (0, 0);
-    }
-  else
-    {
-      octave_idx_type max_nzmx = (r_len > c_len ? r_len : c_len);
-  
-      OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl *, sidx, max_nzmx);
-      OCTAVE_LOCAL_BUFFER (octave_sparse_sort_idxl, sidxX, max_nzmx);
-
-      for (octave_idx_type i = 0; i < max_nzmx; i++)
-        sidx[i] = &sidxX[i];
-
-      octave_idx_type actual_nzmx = 0;
-      octave_quit ();
-
-      for (octave_idx_type i = 0; i < max_nzmx; i++) 
-        {
-          octave_idx_type rowidx = static_cast<octave_idx_type> (ri_scalar ? r(0) : r(i));
-          octave_idx_type colidx = static_cast<octave_idx_type> (ci_scalar ? c(0) : c(i));
-          if (rowidx < nr && rowidx >= 0 &&
-              colidx < nc && colidx >= 0 ) 
-            {
-              if ( a (cf_scalar ? 0 : i ) != T ()) 
-                {
-                  sidx[actual_nzmx]->r = rowidx;
-                  sidx[actual_nzmx]->c = colidx;
-                  sidx[actual_nzmx]->idx = i;
-                  actual_nzmx++;        
-                }
-            }
-          else 
-            {
-              (*current_liboctave_error_handler)
-                ("Sparse::Sparse : index (%d,%d) out of range", 
-                 rowidx + 1, colidx + 1);
-              rep = nil_rep ();
-              dimensions = dim_vector (0, 0);
-              return;
-            }
-        }
-
-      if (actual_nzmx == 0)
-        rep = new typename Sparse<T>::SparseRep (nr, nc);
-      else
-        {
-          octave_quit ();
-          octave_sort<octave_sparse_sort_idxl *> 
-            lsort (octave_sparse_sidxl_comp);
-
-          lsort.sort (sidx, actual_nzmx);
-          octave_quit ();
-
-          // Now count the unique non-zero values
-          octave_idx_type real_nzmx = 1;
-          for (octave_idx_type i = 1; i < actual_nzmx; i++) 
-            if (sidx[i-1]->r != sidx[i]->r || sidx[i-1]->c != sidx[i]->c) 
-              real_nzmx++;
-
-          rep = new typename Sparse<T>::SparseRep (nr, nc, real_nzmx);
-
-          octave_idx_type cx = 0;
-          octave_idx_type prev_rval = -1;
-          octave_idx_type prev_cval = -1;
-          octave_idx_type ii = -1;
-          xcidx (0) = 0;
-          for (octave_idx_type i = 0; i < actual_nzmx; i++) 
-            {
-              octave_quit ();
-              octave_idx_type iidx = sidx[i]->idx;
-              octave_idx_type rval = sidx[i]->r;
-              octave_idx_type cval = sidx[i]->c;
-
-              if (prev_cval < cval || (prev_rval < rval && prev_cval == cval)) 
-                {
-                  octave_idx_type ci = static_cast<octave_idx_type> (c (ci_scalar ? 0 : iidx));
-                  ii++;
-
-                  while (cx < ci) 
-                    xcidx (++cx) = ii;
-                  xdata(ii) = a (cf_scalar ? 0 : iidx);
-                  xridx(ii) = static_cast<octave_idx_type> (r (ri_scalar ? 0 : iidx));
-                } 
-              else 
-                {
-                  if (sum_terms)
-                    xdata(ii) += a (cf_scalar ? 0 : iidx);
-                  else
-                    xdata(ii) =  a (cf_scalar ? 0 : iidx);
-                }
-              prev_rval = rval;
-              prev_cval = cval;
-            } 
-
-          while (cx < nc) 
-            xcidx (++cx) = ii + 1;
-        }
-    }
-}
-
-template <class T>
 Sparse<T>::Sparse (const Array<T>& a, const idx_vector& r, 
                    const idx_vector& c, octave_idx_type nr,
                    octave_idx_type nc, bool sum_terms)
--- a/liboctave/Sparse.h	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/Sparse.h	Wed Mar 31 10:24:57 2010 +0200
@@ -217,12 +217,6 @@
 
   Sparse (const Sparse<T>& a, const dim_vector& dv);
 
-  Sparse (const Array<T>& a, const Array<octave_idx_type>& r, const Array<octave_idx_type>& c,
-          octave_idx_type nr, octave_idx_type nc, bool sum_terms);
-
-  Sparse (const Array<T>& a, const Array<double>& r, const Array<double>& c,
-          octave_idx_type nr, octave_idx_type nc, bool sum_terms);
-
   Sparse (const Array<T>& a, const idx_vector& r, const idx_vector& c,
           octave_idx_type nr = -1, octave_idx_type nc = -1, bool sum_terms = true);
 
--- a/liboctave/boolSparse.h	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/boolSparse.h	Wed Mar 31 10:24:57 2010 +0200
@@ -55,16 +55,6 @@
 
   explicit SparseBoolMatrix (const boolNDArray& a) : Sparse<bool> (a) { }
 
-  explicit SparseBoolMatrix (const Array<bool> a, const Array<octave_idx_type>& r, 
-                             const Array<octave_idx_type>& c, octave_idx_type nr = -1, 
-                             octave_idx_type nc = -1, bool sum_terms = true)
-    : Sparse<bool> (a, r, c, nr, nc, sum_terms) { }
-
-  explicit SparseBoolMatrix (const Array<bool> a, const Array<double>& r, 
-                             const Array<double>& c, octave_idx_type nr = -1, 
-                             octave_idx_type nc = -1, bool sum_terms = true)
-    : Sparse<bool> (a, r, c, nr, nc, sum_terms) { }
-
   SparseBoolMatrix (const Array<bool>& a, const idx_vector& r, 
                     const idx_vector& c, octave_idx_type nr = -1, 
                     octave_idx_type nc = -1, bool sum_terms = true)
--- a/liboctave/dSparse.h	Wed Mar 31 10:03:55 2010 +0200
+++ b/liboctave/dSparse.h	Wed Mar 31 10:24:57 2010 +0200
@@ -72,16 +72,6 @@
 
   explicit SparseMatrix (const NDArray& a) : MSparse<double> (a) { }
 
-  explicit SparseMatrix (const Array<double> a, const Array<octave_idx_type>& r, 
-                         const Array<octave_idx_type>& c, octave_idx_type nr = -1, 
-                         octave_idx_type nc = -1, bool sum_terms = true)
-    : MSparse<double> (a, r, c, nr, nc, sum_terms) { }
-
-  explicit SparseMatrix (const Array<double> a, const Array<double>& r, 
-                         const Array<double>& c, octave_idx_type nr = -1, 
-                         octave_idx_type nc = -1, bool sum_terms = true)
-    : MSparse<double> (a, r, c, nr, nc, sum_terms) { }
-
   SparseMatrix (const Array<double>& a, const idx_vector& r, 
                 const idx_vector& c, octave_idx_type nr = -1, 
                 octave_idx_type nc = -1, bool sum_terms = true)