GNU Octave  8.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 Properties Friends Macros Pages
qr.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-2023 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 (void) : 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 (void) = default;
78 
79  T Q (void) const { return m_q; }
80 
81  T R (void) const { return m_r; }
82 
83  OCTAVE_API type get_type (void) const;
84 
85  OCTAVE_API bool regular (void) 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 
116 extern OCTAVE_API void warn_qrupdate_once (void);
117 
120 
121 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: qr.h:40
OCTAVE_API void shift_cols(octave_idx_type i, octave_idx_type j)
OCTAVE_API void delete_col(const Array< octave_idx_type > &j)
T::element_type ELT_T
Definition: qr.h:43
T::row_vector_type RV_T
Definition: qr.h:44
OCTAVE_API void insert_row(const RV_T &u, octave_idx_type j)
virtual ~qr(void)=default
type
Definition: qr.h:48
@ std
Definition: qr.h:49
@ raw
Definition: qr.h:50
OCTAVE_API void insert_col(const CV_T &u, octave_idx_type j)
qr(void)
Definition: qr.h:54
OCTAVE_API void delete_col(octave_idx_type j)
OCTAVE_API void insert_col(const T &u, const Array< octave_idx_type > &j)
T m_r
Definition: qr.h:110
T Q(void) const
Definition: qr.h:79
OCTAVE_API void update(const T &u, const T &v)
T R(void) const
Definition: qr.h:81
OCTAVE_API void update(const CV_T &u, const CV_T &v)
T m_q
Definition: qr.h:109
qr(const qr &a)
Definition: qr.h:64
OCTAVE_API void form(octave_idx_type n, T &afact, ELT_T *tau, type qr_type)
OCTAVE_API void delete_row(octave_idx_type j)
OCTAVE_API void init(const T &a, type qr_type)
T::column_vector_type CV_T
Definition: qr.h:45
qr(const T &a, type qr_type=qr::std)
Definition: qr.h:56
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static math::qr< T >::type qr_type(int nargout, bool economy)
Definition: qr.cc:74
#define OCTAVE_API
Definition: main.in.cc:55
octave_idx_type n
Definition: mx-inlines.cc:753
OCTAVE_API void warn_qrupdate_once(void)