annotate liboctave/numeric/gsvd.h @ 22945:eb01d0178188

use F77_INT instead of octave_idx_type for liboctave gsvd class * gsvd.h, gsvd.cc: Use F77_INT instead of octave_idx_type for integer data passed to Fortran subroutines. Use octave_f77_int_type in public header file.
author John W. Eaton <jwe@octave.org>
date Mon, 26 Dec 2016 19:23:31 -0500
parents 87e3163f6c87
children debe0c7dcefc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
1 /*
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
2
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
3 Copyright (C) 2016 Barbara Lócsi
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
4 Copyright (C) 2006 Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
5 Copyright (C) 1996, 1997 John W. Eaton
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
6
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
7 This file is part of Octave.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
8
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
9 Octave is free software; you can redistribute it and/or modify it
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
10 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
11 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
12 (at your option) any later version.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
13
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
14 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
15 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
17 GNU General Public License for more details.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
18
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
19 You should have received a copy of the GNU General Public License
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
20 along with Octave; see the file COPYING. If not, see
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
21 <http://www.gnu.org/licenses/>.
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
22
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22737
diff changeset
23 */
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
24
22737
7abc25e6206a maint: Clean up code base to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 22437
diff changeset
25 #if ! defined (octave_gsvd_h)
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
26 #define octave_gsvd_h 1
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
27
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
28 #include "octave-config.h"
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
29
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
30 namespace octave
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
31 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
32 namespace math
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
33 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
34 template <typename T>
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
35 class
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
36 gsvd
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
37 {
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
38 public:
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
39
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
40 enum class Type
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
41 {
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
42 std,
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
43 economy,
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
44 sigma_only
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
45 };
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
46
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
47 gsvd (void) : sigmaA (), sigmaB (), left_smA (), left_smB (), right_sm ()
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
48 { }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
49
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
50 gsvd (const T& a, const T& b,
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
51 gsvd::Type gsvd_type = gsvd<T>::Type::economy);
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
52
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
53 gsvd (const gsvd& a)
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
54 : type (a.type),
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
55 sigmaA (a.sigmaA), sigmaB (a.sigmaB),
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
56 left_smA (a.left_smA), left_smB (a.left_smB), right_sm (a.right_sm),
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
57 R(a.R) { }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
58
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
59 gsvd& operator = (const gsvd& a)
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
60 {
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
61 if (this != &a)
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
62 {
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
63 type = a.type;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
64 sigmaA = a.sigmaA;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
65 sigmaB = a.sigmaB;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
66 left_smA = a.left_smA;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
67 left_smB = a.left_smB;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
68 right_sm = a.right_sm;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
69 R = a.R;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
70 }
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
71
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
72 return *this;
22402
4caa7b28d183 maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents: 22323
diff changeset
73 }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
74
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
75 ~gsvd (void) = default;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
76
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
77 typename T::real_diag_matrix_type
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
78 singular_values_A (void) const { return sigmaA; }
22436
09005ac7d56c gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents: 22402
diff changeset
79
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
80 typename T::real_diag_matrix_type
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
81 singular_values_B (void) const { return sigmaB; }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
82
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
83 T left_singular_matrix_A (void) const;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
84 T left_singular_matrix_B (void) const;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
85
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
86 T right_singular_matrix (void) const;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
87 T R_matrix (void) const;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
88
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
89 private:
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
90 typedef typename T::value_type P;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
91 typedef typename T::real_matrix_type real_matrix;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
92
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
93 gsvd::Type type;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
94 typename T::real_diag_matrix_type sigmaA, sigmaB;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
95 T left_smA, left_smB;
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
96 T right_sm, R;
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
97
22945
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
98 void ggsvd (char& jobu, char& jobv, char& jobq, octave_f77_int_type m,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
99 octave_f77_int_type n, octave_f77_int_type p,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
100 octave_f77_int_type& k, octave_f77_int_type& l,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
101 P *tmp_dataA, octave_f77_int_type m1,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
102 P *tmp_dataB, octave_f77_int_type p1,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
103 real_matrix& alpha, real_matrix& beta,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
104 P *u, octave_f77_int_type nrow_u,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
105 P *v, octave_f77_int_type nrow_v,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
106 P *q, octave_f77_int_type nrow_q,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
107 T& work, octave_f77_int_type* iwork,
eb01d0178188 use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
108 octave_f77_int_type& info);
22437
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
109 };
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
110 }
0aee8b620864 gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents: 22436
diff changeset
111 }
22236
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
112
065a44375723 gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff changeset
113 #endif