Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
8967:5bbbf482909a | 8968:91d53dc37f79 |
---|---|
49 #include "sparse-util.h" | 49 #include "sparse-util.h" |
50 #include "SparseCmplxCHOL.h" | 50 #include "SparseCmplxCHOL.h" |
51 #include "SparseCmplxQR.h" | 51 #include "SparseCmplxQR.h" |
52 | 52 |
53 #include "Sparse-diag-op-defs.h" | 53 #include "Sparse-diag-op-defs.h" |
54 | |
55 #include "Sparse-perm-op-defs.h" | |
54 | 56 |
55 // Define whether to use a basic QR solver or one that uses a Dulmange | 57 // Define whether to use a basic QR solver or one that uses a Dulmange |
56 // Mendelsohn factorization to seperate the problem into under-determined, | 58 // Mendelsohn factorization to seperate the problem into under-determined, |
57 // well-determined and over-determined parts and solves them seperately | 59 // well-determined and over-determined parts and solves them seperately |
58 #ifndef USE_QRSOLVE | 60 #ifndef USE_QRSOLVE |
7682 operator - (const SparseComplexMatrix&a, const ComplexDiagMatrix& d) | 7684 operator - (const SparseComplexMatrix&a, const ComplexDiagMatrix& d) |
7683 { | 7685 { |
7684 return do_sub_sm_dm<SparseComplexMatrix> (a, d); | 7686 return do_sub_sm_dm<SparseComplexMatrix> (a, d); |
7685 } | 7687 } |
7686 | 7688 |
7689 // perm * sparse and sparse * perm | |
7690 | |
7691 SparseComplexMatrix | |
7692 operator * (const PermMatrix& p, const SparseComplexMatrix& a) | |
7693 { | |
7694 return octinternal_do_mul_pm_sm (p, a); | |
7695 } | |
7696 | |
7697 SparseComplexMatrix | |
7698 operator * (const SparseComplexMatrix& a, const PermMatrix& p) | |
7699 { | |
7700 return octinternal_do_mul_sm_pm (a, p); | |
7701 } | |
7702 | |
7687 // FIXME -- it would be nice to share code among the min/max | 7703 // FIXME -- it would be nice to share code among the min/max |
7688 // functions below. | 7704 // functions below. |
7689 | 7705 |
7690 #define EMPTY_RETURN_CHECK(T) \ | 7706 #define EMPTY_RETURN_CHECK(T) \ |
7691 if (nr == 0 || nc == 0) \ | 7707 if (nr == 0 || nc == 0) \ |