GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qr.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-2024 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 #include "Array-fwd.h"
32 
34 
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 () : m_q (), m_r () { }
55 
56  qr (const T& a, type qr_type = qr::std)
57  : m_q (), m_r ()
58  {
59  init (a, qr_type);
60  }
61 
62  OCTAVE_API qr (const T& m_q, const T& m_r);
63 
64  qr (const qr& a) : m_q (a.m_q), m_r (a.m_r) { }
65 
66  qr& operator = (const qr& a)
67  {
68  if (this != &a)
69  {
70  m_q = a.m_q;
71  m_r = a.m_r;
72  }
73 
74  return *this;
75  }
76 
77  virtual ~qr () = default;
78 
79  T Q () const { return m_q; }
80 
81  T R () const { return m_r; }
82 
83  OCTAVE_API type get_type () const;
84 
85  OCTAVE_API bool regular () const;
86 
87  OCTAVE_API void init (const T& a, type qr_type);
88 
89  OCTAVE_API void update (const CV_T& u, const CV_T& v);
90 
91  OCTAVE_API void update (const T& u, const T& v);
92 
94 
95  OCTAVE_API void insert_col (const T& u, const Array<octave_idx_type>& j);
96 
98 
100 
102 
104 
106 
107 protected:
108 
109  T m_q;
110  T m_r;
111 
112  OCTAVE_API void
113  form (octave_idx_type n, T& afact, ELT_T *tau, type qr_type);
114 };
115 
117 
118 OCTAVE_END_NAMESPACE(math)
119 OCTAVE_END_NAMESPACE(octave)
120 
121 #endif
Definition: qr.h:40
void update(const T &u, const T &v)
void insert_row(const RV_T &u, octave_idx_type j)
T::element_type ELT_T
Definition: qr.h:43
void insert_col(const T &u, const Array< octave_idx_type > &j)
void delete_row(octave_idx_type j)
virtual ~qr()=default
qr()
Definition: qr.h:54
T::row_vector_type RV_T
Definition: qr.h:44
void delete_col(octave_idx_type j)
void update(const CV_T &u, const CV_T &v)
type
Definition: qr.h:48
@ std
Definition: qr.h:49
@ raw
Definition: qr.h:50
T Q() const
Definition: qr.h:79
void form(octave_idx_type n, T &afact, ELT_T *tau, type qr_type)
void insert_col(const CV_T &u, octave_idx_type j)
void delete_col(const Array< octave_idx_type > &j)
void shift_cols(octave_idx_type i, octave_idx_type j)
T m_r
Definition: qr.h:110
void init(const T &a, type qr_type)
T m_q
Definition: qr.h:109
qr(const qr &a)
Definition: qr.h:64
T::column_vector_type CV_T
Definition: qr.h:45
T R() const
Definition: qr.h:81
qr(const T &a, type qr_type=qr::std)
Definition: qr.h:56
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition: main.cc:55
octave_idx_type n
Definition: mx-inlines.cc:761
void warn_qrupdate_once()