diff liboctave/sparse-base-lu.cc @ 8969:3ecbc236e2e0

Have sparse LU return permutation matrices rather than sparse matrices. This could well impact user code. It'd be interesting to see if there is any actual fall-out... Quite often, the permutation matrices are applied to *dense* vectors. Returning permutation matrices rather than sparse matrices is a slight performance enhancement, but likely lost in the noise.
author Jason Riedy <jason@acm.org>
date Tue, 10 Mar 2009 21:54:49 -0400
parents 97c84c4c2247
children 4c0cdbe0acca
line wrap: on
line diff
--- a/liboctave/sparse-base-lu.cc
+++ b/liboctave/sparse-base-lu.cc
@@ -98,6 +98,13 @@
 }
 
 template <class lu_type, class lu_elt_type, class p_type, class p_elt_type>
+PermMatrix
+sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pr_mat (void) const
+{
+  return PermMatrix (P, false);
+}
+
+template <class lu_type, class lu_elt_type, class p_type, class p_elt_type>
 p_type
 sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pc (void) const
 {
@@ -131,6 +138,13 @@
   return Pout;
 }
 
+template <class lu_type, class lu_elt_type, class p_type, class p_elt_type>
+PermMatrix
+sparse_base_lu <lu_type, lu_elt_type, p_type, p_elt_type> :: Pc_mat (void) const
+{
+  return PermMatrix (Q, true);
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***