annotate liboctave/numeric/gepbalance.cc @ 23220:092078913d54

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Wed, 22 Feb 2017 12:58:07 -0500
parents ef4d915df748 3ac9f9ecfae5
children d691ed308237
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 /*
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
23219
3ac9f9ecfae5 maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents: 23083
diff changeset
3 Copyright (C) 1994-2017 John W. Eaton
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 This file is part of Octave.
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
8 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
10 (at your option) any later version.
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22402
diff changeset
15 GNU General Public License for more details.
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
23 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21268
diff changeset
24 # include "config.h"
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 #endif
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 #include <string>
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #include <vector>
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include "Array-util.h"
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
31 #include "CMatrix.h"
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
32 #include "dMatrix.h"
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
33 #include "fCMatrix.h"
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
34 #include "fMatrix.h"
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
35 #include "gepbalance.h"
22322
93b3cdd36854 move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents: 22317
diff changeset
36 #include "lo-lapack-proto.h"
8377
25bc2d31e1bf improve OCTAVE_LOCAL_BUFFER
Jaroslav Hajek <highegg@gmail.com>
parents: 7792
diff changeset
37 #include "oct-locbuf.h"
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
22317
6ca3acf5fad8 move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents: 22135
diff changeset
39 namespace octave
6ca3acf5fad8 move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents: 22135
diff changeset
40 {
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
41 namespace math
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
42 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
43 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
44 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
45 gepbalance<Matrix>::init (const Matrix& a, const Matrix& b,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
46 const std::string& balance_job)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
47 {
22988
cd33c785e80e put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22952
diff changeset
48 F77_INT n = octave::to_f77_int (a.cols ());
22317
6ca3acf5fad8 move some new numeric classes to namespace octave::math
John W. Eaton <jwe@octave.org>
parents: 22135
diff changeset
49
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
50 if (a.rows () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
51 (*current_liboctave_error_handler) ("GEPBALANCE requires square matrix");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
52
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
53 if (a.dims () != b.dims ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
54 octave::err_nonconformant ("GEPBALANCE", n, n, b.rows(), b.cols());
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
56 F77_INT info;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
57 F77_INT ilo;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
58 F77_INT ihi;
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
60 OCTAVE_LOCAL_BUFFER (double, plscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
61 OCTAVE_LOCAL_BUFFER (double, prscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
62 OCTAVE_LOCAL_BUFFER (double, pwork, 6 * n);
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
64 balanced_mat = a;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
65 double *p_balanced_mat = balanced_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
66 balanced_mat2 = b;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
67 double *p_balanced_mat2 = balanced_mat2.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
68
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
69 char job = balance_job[0];
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
71 F77_XFCN (dggbal, DGGBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
72 n, p_balanced_mat, n, p_balanced_mat2,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
73 n, ilo, ihi, plscale, prscale, pwork, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
74 F77_CHAR_ARG_LEN (1)));
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
76 balancing_mat = Matrix (n, n, 0.0);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
77 balancing_mat2 = Matrix (n, n, 0.0);
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
78 for (F77_INT i = 0; i < n; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
79 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
80 octave_quit ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
81 balancing_mat.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
82 balancing_mat2.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
83 }
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
85 double *p_balancing_mat = balancing_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
86 double *p_balancing_mat2 = balancing_mat2.fortran_vec ();
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
88 // first left
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
89 F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
90 F77_CONST_CHAR_ARG2 ("L", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
91 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
92 n, p_balancing_mat, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
93 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
94 F77_CHAR_ARG_LEN (1)));
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
96 // then right
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
97 F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
98 F77_CONST_CHAR_ARG2 ("R", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
99 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
100 n, p_balancing_mat2, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
101 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
102 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
103
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
104 return info;
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 }
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
107 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
108 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
109 gepbalance<FloatMatrix>::init (const FloatMatrix& a, const FloatMatrix& b,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
110 const std::string& balance_job)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
111 {
22988
cd33c785e80e put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22952
diff changeset
112 F77_INT n = octave::to_f77_int (a.cols ());
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
114 if (a.rows () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
115 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
116 ("FloatGEPBALANCE requires square matrix");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
117
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
118 if (a.dims () != b.dims ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
119 octave::err_nonconformant ("FloatGEPBALANCE", n, n, b.rows(), b.cols());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
120
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
121 F77_INT info;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
122 F77_INT ilo;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
123 F77_INT ihi;
7792
39c1026191e9 add missing files from single-precision merge
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
125 OCTAVE_LOCAL_BUFFER (float, plscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
126 OCTAVE_LOCAL_BUFFER (float, prscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
127 OCTAVE_LOCAL_BUFFER (float, pwork, 6 * n);
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
128
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
129 balanced_mat = a;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
130 float *p_balanced_mat = balanced_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
131 balanced_mat2 = b;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
132 float *p_balanced_mat2 = balanced_mat2.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
133
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
134 char job = balance_job[0];
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
135
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
136 F77_XFCN (sggbal, SGGBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
137 n, p_balanced_mat, n, p_balanced_mat2,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
138 n, ilo, ihi, plscale, prscale, pwork, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
139 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
140
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
141 balancing_mat = FloatMatrix (n, n, 0.0);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
142 balancing_mat2 = FloatMatrix (n, n, 0.0);
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
143 for (F77_INT i = 0; i < n; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
144 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
145 octave_quit ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
146 balancing_mat.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
147 balancing_mat2.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
148 }
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
149
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
150 float *p_balancing_mat = balancing_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
151 float *p_balancing_mat2 = balancing_mat2.fortran_vec ();
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
152
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
153 // first left
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
154 F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
155 F77_CONST_CHAR_ARG2 ("L", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
156 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
157 n, p_balancing_mat, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
158 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
159 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
160
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
161 // then right
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
162 F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
163 F77_CONST_CHAR_ARG2 ("R", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
164 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
165 n, p_balancing_mat2, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
166 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
167 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
168
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
169 return info;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
170 }
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
171
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
172 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
173 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
174 gepbalance<ComplexMatrix>::init (const ComplexMatrix& a,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
175 const ComplexMatrix& b,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
176 const std::string& balance_job)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
177 {
22988
cd33c785e80e put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22952
diff changeset
178 F77_INT n = octave::to_f77_int (a.cols ());
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
179
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
180 if (a.rows () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
181 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
182 ("ComplexGEPBALANCE requires square matrix");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
183
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
184 if (a.dims () != b.dims ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
185 octave::err_nonconformant ("ComplexGEPBALANCE", n, n, b.rows(), b.cols());
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
186
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
187 F77_INT info;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
188 F77_INT ilo;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
189 F77_INT ihi;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
190
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
191 OCTAVE_LOCAL_BUFFER (double, plscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
192 OCTAVE_LOCAL_BUFFER (double, prscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
193 OCTAVE_LOCAL_BUFFER (double, pwork, 6 * n);
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
194
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
195 balanced_mat = a;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
196 Complex *p_balanced_mat = balanced_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
197 balanced_mat2 = b;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
198 Complex *p_balanced_mat2 = balanced_mat2.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
199
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
200 char job = balance_job[0];
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
201
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
202 F77_XFCN (zggbal, ZGGBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
203 n, F77_DBLE_CMPLX_ARG (p_balanced_mat), n, F77_DBLE_CMPLX_ARG (p_balanced_mat2),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
204 n, ilo, ihi, plscale, prscale, pwork, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
205 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
206
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
207 balancing_mat = Matrix (n, n, 0.0);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
208 balancing_mat2 = Matrix (n, n, 0.0);
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
209 for (F77_INT i = 0; i < n; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
210 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
211 octave_quit ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
212 balancing_mat.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
213 balancing_mat2.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
214 }
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
215
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
216 double *p_balancing_mat = balancing_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
217 double *p_balancing_mat2 = balancing_mat2.fortran_vec ();
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
218
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
219 // first left
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
220 F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
221 F77_CONST_CHAR_ARG2 ("L", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
222 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
223 n, p_balancing_mat, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
224 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
225 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
226
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
227 // then right
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
228 F77_XFCN (dggbak, DGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
229 F77_CONST_CHAR_ARG2 ("R", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
230 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
231 n, p_balancing_mat2, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
232 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
233 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
234
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
235 return info;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
236 }
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
237
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
238 template <>
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
239 octave_idx_type
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
240 gepbalance<FloatComplexMatrix>::init (const FloatComplexMatrix& a,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
241 const FloatComplexMatrix& b,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
242 const std::string& balance_job)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
243 {
22988
cd33c785e80e put to_f77_int inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22952
diff changeset
244 F77_INT n = octave::to_f77_int (a.cols ());
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
245
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
246 if (a.rows () != n)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
247 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
248 (*current_liboctave_error_handler)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
249 ("FloatComplexGEPBALANCE requires square matrix");
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
250 return -1;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
251 }
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
252
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
253 if (a.dims () != b.dims ())
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
254 octave::err_nonconformant ("FloatComplexGEPBALANCE", n, n, b.rows(), b.cols());
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
255
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
256 F77_INT info;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
257 F77_INT ilo;
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
258 F77_INT ihi;
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
259
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
260 OCTAVE_LOCAL_BUFFER (float, plscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
261 OCTAVE_LOCAL_BUFFER (float, prscale, n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
262 OCTAVE_LOCAL_BUFFER (float, pwork, 6 * n);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
263
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
264 balanced_mat = a;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
265 FloatComplex *p_balanced_mat = balanced_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
266 balanced_mat2 = b;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
267 FloatComplex *p_balanced_mat2 = balanced_mat2.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
268
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
269 char job = balance_job[0];
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
270
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
271 F77_XFCN (cggbal, CGGBAL, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
272 n, F77_CMPLX_ARG (p_balanced_mat), n, F77_CMPLX_ARG (p_balanced_mat2),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
273 n, ilo, ihi, plscale, prscale, pwork, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
274 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
275
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
276 balancing_mat = FloatMatrix (n, n, 0.0);
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
277 balancing_mat2 = FloatMatrix (n, n, 0.0);
22952
7c9492d3b421 use F77_INT instead of octave_idx_type for liboctave GEPBALANCE functions
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
278 for (F77_INT i = 0; i < n; i++)
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
279 {
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
280 octave_quit ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
281 balancing_mat.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
282 balancing_mat2.elem (i ,i) = 1.0;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
283 }
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
284
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
285 float *p_balancing_mat = balancing_mat.fortran_vec ();
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
286 float *p_balancing_mat2 = balancing_mat2.fortran_vec ();
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
287
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
288 // first left
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
289 F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
290 F77_CONST_CHAR_ARG2 ("L", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
291 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
292 n, p_balancing_mat, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
293 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
294 F77_CHAR_ARG_LEN (1)));
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
295
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
296 // then right
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
297 F77_XFCN (sggbak, SGGBAK, (F77_CONST_CHAR_ARG2 (&job, 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
298 F77_CONST_CHAR_ARG2 ("R", 1),
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
299 n, ilo, ihi, plscale, prscale,
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
300 n, p_balancing_mat2, n, info
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
301 F77_CHAR_ARG_LEN (1)
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
302 F77_CHAR_ARG_LEN (1)));
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
303
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
304 return info;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
305 }
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
306
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
307 // Instantiations we need.
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
308
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
309 template class gepbalance<Matrix>;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
310
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
311 template class gepbalance<FloatMatrix>;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
312
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
313 template class gepbalance<ComplexMatrix>;
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
314
22329
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
315 template class gepbalance<FloatComplexMatrix>;
7f3c7a8bd131 maint: Indent namespaces in liboctave/numeric files.
John W. Eaton <jwe@octave.org>
parents: 22327
diff changeset
316 }
21268
f08ae27289e4 better use of templates for balance classes
John W. Eaton <jwe@octave.org>
parents: 21202
diff changeset
317 }