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_qrp_h)
27 #define octave_qrp_h 1
28 
29 #include "octave-config.h"
30 
31 #include "PermMatrix.h"
32 #include "qr.h"
33 
34 namespace octave
35 {
36   namespace math
37   {
38     template <typename T>
39     class
40     qrp : public qr<T>
41     {
42     public:
43 
44       typedef typename T::real_row_vector_type RV_T;
45 
46       typedef typename qr<T>::type type;
47 
qrp(void)48       qrp (void) : qr<T> (), p () { }
49 
50       qrp (const T&, type = qr<T>::std);
51 
qrp(const qrp & a)52       qrp (const qrp& a) : qr<T> (a), p (a.p) { }
53 
54       qrp& operator = (const qrp& a)
55       {
56         if (this != &a)
57           {
58             qr<T>::operator = (a);
59             p = a.p;
60           }
61 
62         return *this;
63       }
64 
65       ~qrp (void) = default;
66 
67       void init (const T&, type = qr<T>::std);
68 
P(void)69       PermMatrix P (void) const { return p; }
70 
71       RV_T Pvec (void) const;
72 
73     private:
74 
75       PermMatrix p;
76     };
77   }
78 }
79 
80 #endif
81