Mercurial > octave
annotate liboctave/numeric/qrp.h @ 21280:ebdf74c15722
better use of templates for qrp classes
* liboctave/numeric/qrp.h, liboctave/numeric/qrp.cc: New files for qrp
classes generated from CmplxQRP.cc, CmplxQRP.h, dbleQRP.cc, dbleQRP.h,
fCmplxQRP.cc, fCmplxQRP.h, floatQRP.cc, and floatQRP.h with classes
converted to templates.
* liboctave/numeric/module.mk: Update.
* qr.cc, mx-defs.h: Use new classes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 17 Feb 2016 02:54:00 -0500 |
parents | liboctave/numeric/dbleQRP.h@eb1524b07fe3 |
children | 6ca3acf5fad8 |
rev | line source |
---|---|
538 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17822
diff
changeset
|
3 Copyright (C) 1994-2015 John W. Eaton |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
4 Copyright (C) 2009 VZLU Prague |
538 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
538 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
538 | 21 |
22 */ | |
23 | |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
24 #if ! defined (octave_qrp_h) |
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
25 #define octave_qrp_h 1 |
538 | 26 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
28 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
29 #include "PermMatrix.h" |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
30 #include "qr.h" |
538 | 31 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
32 template <typename T> |
1881 | 33 class |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
34 qrp : public qr<T> |
538 | 35 { |
36 public: | |
37 | |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
38 typedef typename T::real_row_vector_type RV_T; |
21279
eb1524b07fe3
better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
40 typedef typename qr<T>::type type; |
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
41 |
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
42 qrp (void) : qr<T> (), p () { } |
538 | 43 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
44 qrp (const T&, type = qr<T>::std); |
538 | 45 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
46 qrp (const qrp& a) : qr<T> (a), p (a.p) { } |
538 | 47 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
48 qrp& operator = (const qrp& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
49 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
51 { |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
52 qr<T>::operator = (a); |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
53 p = a.p; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
54 } |
538 | 55 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 } |
1528 | 58 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
59 ~qrp (void) { } |
1922 | 60 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
61 void init (const T&, type = qr<T>::std); |
2763 | 62 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
63 PermMatrix P (void) const { return p; } |
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
64 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
65 RV_T Pvec (void) const; |
538 | 66 |
21280
ebdf74c15722
better use of templates for qrp classes
John W. Eaton <jwe@octave.org>
parents:
21279
diff
changeset
|
67 private: |
538 | 68 |
8367
445d27d79f4e
support permutation matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
7017
diff
changeset
|
69 PermMatrix p; |
538 | 70 }; |
71 | |
72 #endif |