diff liboctave/dSparse.h @ 8966:1bba53c0a38d

Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag. Date: Mon, 9 Mar 2009 17:45:22 -0400 This does not use the typical sparse-mx-ops generator. I suspect the sematics of elementwise multiplication and division to be rather controversial, so they are not included. If comparison operations are added, the implementation should be shifted over to use the typical generator. The template in Sparse-diag-op-defs.h likely could use const bools rather than functional argument operations. I haven't measured which is optimized more effectively. Also, the Octave binding layer in op-dm-scm.cc likely could use all sorts of macro or template trickery, but it's far easier to let Emacs handle it for now. That would be worth revisiting if further elementwise sparse and diagonal operations are added.
author Jason Riedy <jason@acm.org>
date Mon, 09 Mar 2009 17:49:14 -0400
parents f4f4d65faaa0
children 91d53dc37f79
line wrap: on
line diff
--- a/liboctave/dSparse.h	Mon Mar 09 17:49:14 2009 -0400
+++ b/liboctave/dSparse.h	Mon Mar 09 17:49:14 2009 -0400
@@ -454,6 +454,11 @@
 extern OCTAVE_API SparseMatrix operator * (const DiagMatrix&, const SparseMatrix&);
 extern OCTAVE_API SparseMatrix operator * (const SparseMatrix&, const DiagMatrix&);
 
+extern OCTAVE_API SparseMatrix operator + (const DiagMatrix&, const SparseMatrix&);
+extern OCTAVE_API SparseMatrix operator + (const SparseMatrix&, const DiagMatrix&);
+extern OCTAVE_API SparseMatrix operator - (const DiagMatrix&, const SparseMatrix&);
+extern OCTAVE_API SparseMatrix operator - (const SparseMatrix&, const DiagMatrix&);
+
 extern OCTAVE_API SparseMatrix min (double d, const SparseMatrix& m);
 extern OCTAVE_API SparseMatrix min (const SparseMatrix& m, double d);
 extern OCTAVE_API SparseMatrix min (const SparseMatrix& a, const SparseMatrix& b);