GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sparse-qr.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2017 John W. Eaton
4 Copyright (C) 2005-2016 David Bateman
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_sparse_qr_h)
25 #define octave_sparse_qr_h 1
26 
27 #include "octave-config.h"
28 
29 #include "dMatrix.h"
30 #include "CMatrix.h"
31 #include "dSparse.h"
32 #include "CSparse.h"
33 
34 namespace octave
35 {
36  namespace math
37  {
38  // If the sparse matrix classes become templated on the element type
39  // (i.e., sparse_matrix<double>), then it might be best to make the
40  // template parameter of this class also be the element type instead
41  // of the matrix type.
42 
43  template <typename SPARSE_T>
44  class
45  sparse_qr
46  {
47  public:
48 
49  sparse_qr (void);
50 
51  sparse_qr (const SPARSE_T& a, int order = 0);
52 
53  sparse_qr (const sparse_qr& a);
54 
55  ~sparse_qr (void);
56 
57  sparse_qr& operator = (const sparse_qr& a);
58 
59  bool ok (void) const;
60 
61  SPARSE_T V (void) const;
62 
63  ColumnVector Pinv (void) const;
64 
65  ColumnVector P (void) const;
66 
67  SPARSE_T R (bool econ = false) const;
68 
69  typename SPARSE_T::dense_matrix_type
70  C (const typename SPARSE_T::dense_matrix_type& b) const;
71 
72  typename SPARSE_T::dense_matrix_type
73  Q (void) const;
74 
75  template <typename RHS_T, typename RET_T>
76  static RET_T
77  solve (const SPARSE_T& a, const RHS_T& b,
78  octave_idx_type& info);
79 
80  private:
81 
83 
85 
86  template <typename RHS_T, typename RET_T>
87  RET_T
88  tall_solve (const RHS_T& b, octave_idx_type& info) const;
89 
90  template <typename RHS_T, typename RET_T>
91  RET_T
92  wide_solve (const RHS_T& b, octave_idx_type& info) const;
93  };
94 
95  // Provide qrsolve for backward compatibility.
96 
97  extern Matrix
98  qrsolve (const SparseMatrix& a, const MArray<double>& b,
99  octave_idx_type& info);
100 
101  extern SparseMatrix
102  qrsolve (const SparseMatrix& a, const SparseMatrix& b,
103  octave_idx_type& info);
104 
105  extern ComplexMatrix
106  qrsolve (const SparseMatrix& a, const MArray<Complex>& b,
107  octave_idx_type& info);
108 
109  extern SparseComplexMatrix
110  qrsolve (const SparseMatrix& a, const SparseComplexMatrix& b,
111  octave_idx_type& info);
112 
113  extern ComplexMatrix
114  qrsolve (const SparseComplexMatrix& a, const MArray<double>& b,
115  octave_idx_type& info);
116 
117  extern SparseComplexMatrix
118  qrsolve (const SparseComplexMatrix& a, const SparseMatrix& b,
119  octave_idx_type& info);
120 
121  extern ComplexMatrix
123  octave_idx_type& info);
124 
125  extern SparseComplexMatrix
127  octave_idx_type& info);
128 
131  }
132 }
133 
134 #endif
sparse_qr< SparseComplexMatrix > SparseComplexQR
Definition: sparse-qr.h:130
F77_RET_T const F77_INT const F77_INT const F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE * V
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
Matrix qrsolve(const SparseMatrix &a, const MArray< double > &b, octave_idx_type &info)
Definition: sparse-qr.cc:2288
#define C(a, b)
Definition: Faddeeva.cc:246
ar P
Definition: __luinc__.cc:49
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
Definition: dMatrix.h:37
sparse_qr_rep * rep
Definition: sparse-qr.h:82
b
Definition: cellfun.cc:398
sparse_qr< SparseMatrix > SparseQR
Definition: sparse-qr.h:129
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q