GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
qr.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2018 John W. Eaton
4 Copyright (C) 2008-2009 Jaroslav Hajek
5 Copyright (C) 2009 VZLU Prague
6 
7 This file is part of Octave.
8 
9 Octave is free software: you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Octave is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Octave; see the file COPYING. If not, see
21 <https://www.gnu.org/licenses/>.
22 
23 */
24 
25 #if ! defined (octave_qr_h)
26 #define octave_qr_h 1
27 
28 #include "octave-config.h"
29 
30 template <typename T> class Array;
31 
32 namespace octave
33 {
34  namespace math
35  {
36  template <typename T>
37  class
38  qr
39  {
40  public:
41 
42  typedef typename T::element_type ELT_T;
43  typedef typename T::row_vector_type RV_T;
44  typedef typename T::column_vector_type CV_T;
45 
46  enum type
47  {
48  std,
49  raw,
50  economy
51  };
52 
53  qr (void) : q (), r () { }
54 
55  qr (const T& a, type qr_type = qr::std)
56  : q (), r ()
57  {
58  init (a, qr_type);
59  }
60 
61  qr (const T& q, const T& r);
62 
63  qr (const qr& a) : q (a.q), r (a.r) { }
64 
65  qr& operator = (const qr& a)
66  {
67  if (this != &a)
68  {
69  q = a.q;
70  r = a.r;
71  }
72 
73  return *this;
74  }
75 
76  virtual ~qr (void) = default;
77 
78  T Q (void) const { return q; }
79 
80  T R (void) const { return r; }
81 
82  type get_type (void) const;
83 
84  bool regular (void) const;
85 
86  void init (const T& a, type qr_type);
87 
88  void update (const CV_T& u, const CV_T& v);
89 
90  void update (const T& u, const T& v);
91 
92  void insert_col (const CV_T& u, octave_idx_type j);
93 
94  void insert_col (const T& u, const Array<octave_idx_type>& j);
95 
96  void delete_col (octave_idx_type j);
97 
98  void delete_col (const Array<octave_idx_type>& j);
99 
100  void insert_row (const RV_T& u, octave_idx_type j);
101 
102  void delete_row (octave_idx_type j);
103 
104  void shift_cols (octave_idx_type i, octave_idx_type j);
105 
106  protected:
107 
108  T q;
109  T r;
110 
111  void form (octave_idx_type n, T& afact, ELT_T *tau, type qr_type);
112  };
113 
114  extern void warn_qrupdate_once (void);
115  }
116 }
117 
118 #endif
qr(void)
Definition: qr.h:53
OCTAVE_EXPORT octave_value_list while another program execution is suspended until the graphics object the function returns immediately In the second form
Definition: graphics.cc:12177
qr(const T &a, type qr_type=qr::std)
Definition: qr.h:55
u
Definition: lu.cc:138
void warn_qrupdate_once(void)
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:400
T::column_vector_type CV_T
Definition: qr.h:44
static octave::math::qr< T >::type qr_type(int nargout, bool economy)
Definition: qr.cc:56
qr(const qr &a)
Definition: qr.h:63
T Q(void) const
Definition: qr.h:78
idx type
Definition: ov.cc:3114
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:125
T::row_vector_type RV_T
Definition: qr.h:43
T::element_type ELT_T
Definition: qr.h:42
for i
Definition: data.cc:5264
T R(void) const
Definition: qr.h:80