Mercurial > hg > octave-lyh
diff liboctave/Sparse.h @ 13030:b646413c3d0e
Make operators do smarter sparse conversions on permutation matrices.
* Sparse.cc (Sparse<T>::Sparse): New templated ctor, plus two instantiations.
* Sparse.h (Sparse<T>): Declare new ctor.
* MSparse.h (MSparse): Give this class a PermMatrix ctor.
* boolSparse.h (BoolSparseMatrix): Ditto.
* dSparse.cc: Refactor PermMatrix ctor, moved into common parent class.
* dSparse.h (SparseMatrix): Ditto.
* op-pm-sm.cc: Declare and install smarter permutation matrix operators.
* ov-perm.cc (octave_perm_matrix): Declare new virtual function override.
* ov-perm.cc (sparse_bool_matrix_value): Override this virtual function.
author | Jordi Gutiérrez Hermoso <jordigh@gmail.com> |
---|---|
date | Tue, 30 Aug 2011 18:36:06 -0500 |
parents | a21a3875ca83 |
children | 43cc49c7abd1 |
line wrap: on
line diff
--- a/liboctave/Sparse.h +++ b/liboctave/Sparse.h @@ -41,6 +41,7 @@ #include "oct-mem.h" class idx_vector; +class PermMatrix; // Two dimensional sparse class. Handles the reference counting for // all the derived classes. @@ -195,6 +196,10 @@ : rep (new typename Sparse<T>::SparseRep (nr, nc, nz)), dimensions (dim_vector (nr, nc)) { } + // Both SparseMatrix and SparseBoolMatrix need this ctor, and this + // is their only common ancestor. + explicit Sparse (const PermMatrix& a); + // Type conversion case. Preserves capacity (). template <class U> Sparse (const Sparse<U>& a)