Mercurial > octave
annotate liboctave/numeric/hess.h @ 21267:f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
* liboctave/numeric/hess.h, liboctave/numeric/hess.cc:
New files generated from HESS.h, HESS.cc, CmplxHESS.h,
CmplxHESS.cc, dbleHESS.h, dbleHESS.cc, fCmplxHESS.h,
fCmplxHESS.cc, floatHESS.h, and floatHESS.cc and making them
templates.
* liboctave/numeric/module.mk: Update.
* libinterp/corefcn/hess.cc, mx-defs.h, mx-ext.h: Use new template
classes and header file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 15 Feb 2016 22:33:45 -0500 |
parents | liboctave/numeric/dbleHESS.h@1473547f50f5 |
children | 6ca3acf5fad8 |
rev | line source |
---|---|
457 | 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 |
457 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
457 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
457 | 20 |
21 */ | |
22 | |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
23 #if ! defined (octave_hess_h) |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
24 #define octave_hess_h 1 |
457 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
28 #include <iosfwd> |
457 | 29 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
30 template <typename T> |
1881 | 31 class |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
32 hess |
457 | 33 { |
34 public: | |
35 | |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 hess (void) |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 : hess_mat (), unitary_hess_mat () |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 { } |
457 | 39 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 hess (const T& a) |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
41 : hess_mat (), unitary_hess_mat () |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
42 { |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
43 init (a); |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
44 } |
1528 | 45 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
46 hess (const T& a, octave_idx_type& info) |
11498
367bfee35ba0
data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10312
diff
changeset
|
47 : hess_mat (), unitary_hess_mat () |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
48 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
49 info = init (a); |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 } |
1528 | 51 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
52 hess (const hess& a) |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
53 : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat) |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
54 { } |
457 | 55 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
56 hess& operator = (const hess& a) |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
57 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
58 if (this != &a) |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
59 { |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 hess_mat = a.hess_mat; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 unitary_hess_mat = a.unitary_hess_mat; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 } |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
63 |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 return *this; |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 } |
1528 | 66 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
67 ~hess (void) { } |
1528 | 68 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
69 T hess_matrix (void) const { return hess_mat; } |
1528 | 70 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
71 T unitary_hess_matrix (void) const { return unitary_hess_mat; } |
457 | 72 |
73 private: | |
74 | |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
75 T hess_mat; |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
76 T unitary_hess_mat; |
1881 | 77 |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
78 octave_idx_type init (const T& a); |
457 | 79 }; |
80 | |
21267
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
81 template <typename T> |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 extern std::ostream& |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
83 operator << (std::ostream& os, const hess<T>& a); |
f5b8c3aca5f8
make better use of templates for Hessenberg decomposition
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
84 |
457 | 85 #endif |