diff liboctave/CSparse.cc @ 8968:91d53dc37f79

Add perm * sparse, perm \ sparse, sparse * perm, and sparse / perm operations. Nothing terribly fancy in any of this. There probably is some mechanism for using the permutation vectors and some assign or index method in the sparse classes, but I've never understood all the intricacies. I'm opting for a simple implementation at the cost of possibly duplicating some functionality.
author Jason Riedy <jason@acm.org>
date Tue, 10 Mar 2009 21:54:44 -0400
parents 5bbbf482909a
children 542015fada9e
line wrap: on
line diff
--- a/liboctave/CSparse.cc
+++ b/liboctave/CSparse.cc
@@ -52,6 +52,8 @@
 
 #include "Sparse-diag-op-defs.h"
 
+#include "Sparse-perm-op-defs.h"
+
 // Define whether to use a basic QR solver or one that uses a Dulmange
 // Mendelsohn factorization to seperate the problem into under-determined,
 // well-determined and over-determined parts and solves them seperately
@@ -7684,6 +7686,20 @@
   return do_sub_sm_dm<SparseComplexMatrix> (a, d);
 }
 
+// perm * sparse and sparse * perm
+
+SparseComplexMatrix
+operator * (const PermMatrix& p, const SparseComplexMatrix& a)
+{
+  return octinternal_do_mul_pm_sm (p, a);
+}
+
+SparseComplexMatrix
+operator * (const SparseComplexMatrix& a, const PermMatrix& p)
+{
+  return octinternal_do_mul_sm_pm (a, p);
+}
+
 // FIXME -- it would be nice to share code among the min/max
 // functions below.