Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (sparse_cmplx_QR_h)
00024 #define sparse_cmplx_QR_h 1
00025
00026 #include <iosfwd>
00027
00028 #include "dMatrix.h"
00029 #include "CMatrix.h"
00030 #include "dSparse.h"
00031 #include "CSparse.h"
00032 #include "oct-sparse.h"
00033
00034 #ifdef IDX_TYPE_LONG
00035 #define CXSPARSE_ZNAME(name) cs_cl ## name
00036 #else
00037 #define CXSPARSE_ZNAME(name) cs_ci ## name
00038 #endif
00039
00040 class
00041 OCTAVE_API
00042 SparseComplexQR
00043 {
00044 protected:
00045 class SparseComplexQR_rep
00046 {
00047 public:
00048 SparseComplexQR_rep (const SparseComplexMatrix& a, int order);
00049
00050 ~SparseComplexQR_rep (void);
00051 #ifdef HAVE_CXSPARSE
00052 bool ok (void) const { return (N && S); }
00053 #else
00054 bool ok (void) const { return false; }
00055 #endif
00056 SparseComplexMatrix V (void) const;
00057
00058 ColumnVector Pinv (void) const;
00059
00060 ColumnVector P (void) const;
00061
00062 SparseComplexMatrix R (const bool econ) const;
00063
00064 ComplexMatrix C (const ComplexMatrix &b) const;
00065
00066 ComplexMatrix Q (void) const;
00067
00068 octave_refcount<int> count;
00069
00070 octave_idx_type nrows;
00071 #ifdef HAVE_CXSPARSE
00072 CXSPARSE_ZNAME (s) *S;
00073
00074 CXSPARSE_ZNAME (n) *N;
00075 #endif
00076 private:
00077
00078
00079
00080 SparseComplexQR_rep (const SparseComplexQR_rep&);
00081
00082 SparseComplexQR_rep operator = (const SparseComplexQR_rep&);
00083
00084 };
00085 private:
00086 SparseComplexQR_rep *rep;
00087
00088 public:
00089 SparseComplexQR (void) :
00090 rep (new SparseComplexQR_rep (SparseComplexMatrix(), 0)) { }
00091
00092 SparseComplexQR (const SparseComplexMatrix& a, int order = 0) :
00093 rep (new SparseComplexQR_rep (a, order)) { }
00094
00095 SparseComplexQR (const SparseComplexQR& a) : rep (a.rep) { rep->count++; }
00096
00097 ~SparseComplexQR (void)
00098 {
00099 if (--rep->count == 0)
00100 delete rep;
00101 }
00102
00103 SparseComplexQR& operator = (const SparseComplexQR& a)
00104 {
00105 if (this != &a)
00106 {
00107 if (--rep->count == 0)
00108 delete rep;
00109
00110 rep = a.rep;
00111 rep->count++;
00112 }
00113 return *this;
00114 }
00115
00116 bool ok (void) const { return rep->ok(); }
00117
00118 SparseComplexMatrix V (void) const { return rep->V(); }
00119
00120 ColumnVector Pinv (void) const { return rep->P(); }
00121
00122 ColumnVector P (void) const { return rep->P(); }
00123
00124 SparseComplexMatrix R (const bool econ = false) const
00125 { return rep->R(econ); }
00126
00127 ComplexMatrix C (const ComplexMatrix &b) const { return rep->C(b); }
00128
00129 ComplexMatrix Q (void) const { return rep->Q(); }
00130
00131 friend ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b,
00132 octave_idx_type &info);
00133
00134 friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a,
00135 const SparseMatrix &b,
00136 octave_idx_type &info);
00137
00138 friend ComplexMatrix qrsolve (const SparseComplexMatrix &a,
00139 const ComplexMatrix &b,
00140 octave_idx_type &info);
00141
00142 friend SparseComplexMatrix qrsolve (const SparseComplexMatrix &a,
00143 const SparseComplexMatrix &b,
00144 octave_idx_type &info);
00145
00146 protected:
00147 #ifdef HAVE_CXSPARSE
00148 CXSPARSE_ZNAME (s) * S (void) { return rep->S; }
00149
00150 CXSPARSE_ZNAME (n) * N (void) { return rep->N; }
00151 #endif
00152 };
00153
00154
00155
00156
00157 extern ComplexMatrix qrsolve (const SparseComplexMatrix &a, const Matrix &b,
00158 octave_idx_type &info);
00159
00160 extern ComplexMatrix qrsolve (const SparseComplexMatrix &a,
00161 const MArray<double> &b,
00162 octave_idx_type &info);
00163
00164 extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a,
00165 const SparseMatrix &b,
00166 octave_idx_type &info);
00167
00168 extern ComplexMatrix qrsolve (const SparseComplexMatrix &a,
00169 const ComplexMatrix &b,
00170 octave_idx_type &info);
00171
00172 extern ComplexMatrix qrsolve (const SparseComplexMatrix &a,
00173 const MArray<Complex> &b,
00174 octave_idx_type &info);
00175
00176 extern SparseComplexMatrix qrsolve (const SparseComplexMatrix &a,
00177 const SparseComplexMatrix &b,
00178 octave_idx_type &info);
00179 #endif