GNU Octave  6.2.0
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-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_qr_h)
27 #define octave_qr_h 1
28 
29 #include "octave-config.h"
30 
31 template <typename T> class Array;
32 
33 namespace octave
34 {
35  namespace math
36  {
37  template <typename T>
38  class
39  qr
40  {
41  public:
42 
43  typedef typename T::element_type ELT_T;
44  typedef typename T::row_vector_type RV_T;
45  typedef typename T::column_vector_type CV_T;
46 
47  enum type
48  {
49  std,
50  raw,
51  economy
52  };
53 
54  qr (void) : q (), r () { }
55 
56  qr (const T& a, type qr_type = qr::std)
57  : q (), r ()
58  {
59  init (a, qr_type);
60  }
61 
62  qr (const T& q, const T& r);
63 
64  qr (const qr& a) : q (a.q), r (a.r) { }
65 
66  qr& operator = (const qr& a)
67  {
68  if (this != &a)
69  {
70  q = a.q;
71  r = a.r;
72  }
73 
74  return *this;
75  }
76 
77  virtual ~qr (void) = default;
78 
79  T Q (void) const { return q; }
80 
81  T R (void) const { return r; }
82 
83  type get_type (void) const;
84 
85  bool regular (void) const;
86 
87  void init (const T& a, type qr_type);
88 
89  void update (const CV_T& u, const CV_T& v);
90 
91  void update (const T& u, const T& v);
92 
93  void insert_col (const CV_T& u, octave_idx_type j);
94 
95  void insert_col (const T& u, const Array<octave_idx_type>& j);
96 
98 
100 
101  void insert_row (const RV_T& u, octave_idx_type j);
102 
104 
106 
107  protected:
108 
109  T q;
110  T r;
111 
112  void form (octave_idx_type n, T& afact, ELT_T *tau, type qr_type);
113  };
114 
115  extern void warn_qrupdate_once (void);
116  }
117 }
118 
119 #endif
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:128
T R(void) const
Definition: qr.h:81
void update(const CV_T &u, const CV_T &v)
void init(const T &a, type qr_type)
void insert_row(const RV_T &u, octave_idx_type j)
T::element_type ELT_T
Definition: qr.h:43
void insert_col(const CV_T &u, octave_idx_type j)
qr(void)
Definition: qr.h:54
T Q(void) const
Definition: qr.h:79
qr(const qr &a)
Definition: qr.h:64
void delete_col(const Array< octave_idx_type > &j)
T::column_vector_type CV_T
Definition: qr.h:45
void shift_cols(octave_idx_type i, octave_idx_type j)
void delete_col(octave_idx_type j)
virtual ~qr(void)=default
T::row_vector_type RV_T
Definition: qr.h:44
void insert_col(const T &u, const Array< octave_idx_type > &j)
void form(octave_idx_type n, T &afact, ELT_T *tau, type qr_type)
void update(const T &u, const T &v)
void delete_row(octave_idx_type j)
qr(const T &a, type qr_type=qr::std)
Definition: qr.h:56
static octave::math::qr< T >::type qr_type(int nargout, bool economy)
Definition: qr.cc:72
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
void warn_qrupdate_once(void)