annotate src/DLD-FUNCTIONS/balance.cc @ 11523:fd0a3ac60b0e

update copyright notices
author John W. Eaton <jwe@octave.org>
date Fri, 14 Jan 2011 05:47:45 -0500
parents a4f482e66b65
children 01f703952eff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
1 /*
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
2
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10846
diff changeset
3 Copyright (C) 1996-2011 John W. Eaton
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10846
diff changeset
4 Copyright (C) 2008-2009 Jaroslav Hajek
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
5
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
7
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
11 option) any later version.
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
12
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
16 for more details.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
17
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5823
diff changeset
20 <http://www.gnu.org/licenses/>.
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
21
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
22 */
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
23
3911
8389e78e67d4 [project @ 2002-04-28 02:15:38 by jwe]
jwe
parents: 3887
diff changeset
24 // Author: A. S. Hodel <scotte@eng.auburn.edu>
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
25
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
27 #include <config.h>
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
28 #endif
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
29
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
30 #include <string>
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
31
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
32 #include "CmplxAEPBAL.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
33 #include "fCmplxAEPBAL.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
34 #include "dbleAEPBAL.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
35 #include "floatAEPBAL.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
36 #include "CmplxGEPBAL.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
37 #include "fCmplxGEPBAL.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
38 #include "dbleGEPBAL.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
39 #include "floatGEPBAL.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3911
diff changeset
40 #include "quit.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
41
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
42 #include "defun-dld.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
43 #include "error.h"
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
44 #include "f77-fcn.h"
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
45 #include "gripes.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
46 #include "oct-obj.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
47 #include "utils.h"
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
48
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
49 DEFUN_DLD (balance, args, nargout,
3548
ab7fa5a8f23f [project @ 2000-02-03 01:17:15 by jwe]
jwe
parents: 3523
diff changeset
50 "-*- texinfo -*-\n\
10840
89f4d7e294cc Grammarcheck .cc files
Rik <octave@nomad.inbox5.com>
parents: 10791
diff changeset
51 @deftypefn {Loadable Function} {@var{aa} =} balance (@var{a}, @var{opt})\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
52 @deftypefnx {Loadable Function} {[@var{dd}, @var{aa}] =} balance (@var{a}, @var{opt})\n\
9048
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
53 @deftypefnx {Loadable Function} {[@var{d}, @var{p}, @var{aa}] =} balance (@var{a}, @var{opt})\n\
3402
9610d364e444 [project @ 2000-01-05 04:36:38 by jwe]
jwe
parents: 3372
diff changeset
54 @deftypefnx {Loadable Function} {[@var{cc}, @var{dd}, @var{aa}, @var{bb}] =} balance (@var{a}, @var{b}, @var{opt})\n\
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
55 \n\
7096
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
56 Compute @code{aa = dd \\ a * dd} in which @code{aa} is a matrix whose\n\
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
57 row and column norms are roughly equal in magnitude, and\n\
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
58 @code{dd} = @code{p * d}, in which @code{p} is a permutation\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
59 matrix and @code{d} is a diagonal matrix of powers of two. This allows\n\
10791
3140cb7a05a1 Add spellchecker scripts for Octave and run spellcheck of documentation
Rik <octave@nomad.inbox5.com>
parents: 10155
diff changeset
60 the equilibration to be computed without round-off. Results of\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
61 eigenvalue calculation are typically improved by balancing first.\n\
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
62 \n\
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
63 If two output values are requested, @code{balance} returns \n\
9064
7c02ec148a3c Check grammar on all .cc files
Rik <rdrider0-list@yahoo.com>
parents: 9048
diff changeset
64 the diagonal @code{d} and the permutation @code{p} separately as vectors. \n\
10846
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10840
diff changeset
65 In this case, @code{dd = eye(n)(:,p) * diag (d)}, where @code{n} is the\n\
a4f482e66b65 Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents: 10840
diff changeset
66 matrix size. \n\
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
67 \n\
7096
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
68 If four output values are requested, compute @code{aa = cc*a*dd} and\n\
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
69 @code{bb = cc*b*dd)}, in which @code{aa} and @code{bb} have non-zero\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
70 elements of approximately the same magnitude and @code{cc} and @code{dd}\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
71 are permuted diagonal matrices as in @code{dd} for the algebraic\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
72 eigenvalue problem.\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
73 \n\
7096
81bed50b9feb [project @ 2007-11-02 16:13:43 by jwe]
jwe
parents: 7017
diff changeset
74 The eigenvalue balancing option @code{opt} may be one of:\n\
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
75 \n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
76 @table @asis\n\
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
77 @item @code{\"noperm\"}, @code{\"S\"}\n\
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
78 Scale only; do not permute.\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
79 \n\
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
80 @item @code{\"noscal\"}, @code{\"P\"}\n\
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
81 Permute only; do not scale.\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
82 @end table\n\
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
83 \n\
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9064
diff changeset
84 Algebraic eigenvalue balancing uses standard @sc{lapack} routines.\n\
3372
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
85 \n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
86 Generalized eigenvalue problem balancing uses Ward's algorithm\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
87 (SIAM Journal on Scientific and Statistical Computing, 1981).\n\
f16c2ce14886 [project @ 1999-11-23 19:07:09 by jwe]
jwe
parents: 3221
diff changeset
88 @end deftypefn")
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
89 {
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
90 octave_value_list retval;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
91
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
92 int nargin = args.length ();
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
93
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
94 if (nargin < 1 || nargin > 3 || nargout < 0 || nargout > 4)
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
95 {
5823
080c08b192d8 [project @ 2006-05-19 05:32:17 by jwe]
jwe
parents: 5307
diff changeset
96 print_usage ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
97 return retval;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
98 }
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
99
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
100 // determine if it's AEP or GEP
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
101 bool AEPcase = nargin == 1 || args(1).is_string ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
102
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
103 // problem dimension
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4628
diff changeset
104 octave_idx_type nn = args(0).rows ();
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
105
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
106 if (nn != args(0).columns())
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
107 {
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
108 gripe_square_matrix_required ("balance");
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
109 return retval;
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
110 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
111
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
112 bool isfloat = args(0).is_single_type () ||
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
113 (! AEPcase && args(1).is_single_type());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
114
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
115 bool complex_case = (args(0).is_complex_type () ||
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
116 (! AEPcase && args(1).is_complex_type ()));
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
117
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
118 // Extract argument 1 parameter for both AEP and GEP.
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
119 Matrix aa;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
120 ComplexMatrix caa;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
121 FloatMatrix faa;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
122 FloatComplexMatrix fcaa;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
123
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
124 if (isfloat)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
125 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
126 if (complex_case)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
127 fcaa = args(0).float_complex_matrix_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
128 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
129 faa = args(0).float_matrix_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
130 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
131 else
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
132 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
133 if (complex_case)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
134 caa = args(0).complex_matrix_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
135 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
136 aa = args(0).matrix_value ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
137 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
138
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
139 if (error_state)
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
140 return retval;
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
141
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
142 // Treat AEP/GEP cases.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
143 if (AEPcase)
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
144 {
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
145 // Algebraic eigenvalue problem.
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
146 bool noperm = false, noscal = false;
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
147 if (nargin > 1)
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
148 {
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
149 std::string a1s = args(1).string_value ();
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
150 noperm = a1s == "noperm" || a1s == "S";
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
151 noscal = a1s == "noscal" || a1s == "P";
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
152 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
153
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
154 // balance the AEP
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
155 if (isfloat)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
156 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
157 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
158 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
159 FloatComplexAEPBALANCE result (fcaa, noperm, noscal);
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
160
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
161 if (nargout == 0 || nargout == 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
162 retval(0) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
163 else if (nargout == 2)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
164 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
165 retval(1) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
166 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
167 }
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
168 else
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
169 {
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
170 retval(2) = result.balanced_matrix ();
9048
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
171 retval(0) = result.scaling_vector ();
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
172 retval(1) = result.permuting_vector ();
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
173 }
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
174
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
175 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
176 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
177 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
178 FloatAEPBALANCE result (faa, noperm, noscal);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
179
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
180 if (nargout == 0 || nargout == 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
181 retval(0) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
182 else if (nargout == 2)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
183 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
184 retval(1) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
185 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
186 }
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
187 else
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
188 {
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
189 retval(2) = result.balanced_matrix ();
9048
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
190 retval(0) = result.scaling_vector ();
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
191 retval(1) = result.permuting_vector ();
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
192 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
193 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
194 }
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
195 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
196 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
197 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
198 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
199 ComplexAEPBALANCE result (caa, noperm, noscal);
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
200
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
201 if (nargout == 0 || nargout == 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
202 retval(0) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
203 else if (nargout == 2)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
204 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
205 retval(1) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
206 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
207 }
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
208 else
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
209 {
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
210 retval(2) = result.balanced_matrix ();
9048
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
211 retval(0) = result.scaling_vector ();
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
212 retval(1) = result.permuting_vector ();
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
213 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
214 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
215 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
216 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
217 AEPBALANCE result (aa, noperm, noscal);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
218
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
219 if (nargout == 0 || nargout == 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
220 retval(0) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
221 else if (nargout == 2)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
222 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
223 retval(1) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
224 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
225 }
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
226 else
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
227 {
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
228 retval(2) = result.balanced_matrix ();
9048
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
229 retval(0) = result.scaling_vector ();
867d5d1aed06 swap out args in balance for M*b compat
Jaroslav Hajek <highegg@gmail.com>
parents: 8386
diff changeset
230 retval(1) = result.permuting_vector ();
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
231 }
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
232 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
233 }
3181
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
234 }
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
235 else
3f6a813eb09e [project @ 1998-09-25 02:50:29 by jwe]
jwe
parents: 3179
diff changeset
236 {
8386
a5e080076778 make balance more Matlab-compatible
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
237 std::string bal_job;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
238 if (nargout == 1)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
239 warning ("balance: used GEP, should have two output arguments");
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
240
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
241 // Generalized eigenvalue problem.
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
242 if (nargin == 2)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
243 bal_job = "B";
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
244 else if (args(2).is_string ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
245 bal_job = args(2).string_value ();
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
246 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
247 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
248 error ("balance: GEP argument 3 must be a string");
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
249 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
250 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
251
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
252 if ((nn != args(1).columns ()) || (nn != args(1).rows ()))
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
253 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
254 gripe_nonconformant ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
255 return retval;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
256 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
257
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
258 Matrix bb;
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
259 ComplexMatrix cbb;
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
260 FloatMatrix fbb;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
261 FloatComplexMatrix fcbb;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
262
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
263 if (isfloat)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
264 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
265 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
266 fcbb = args(1).float_complex_matrix_value ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
267 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
268 fbb = args(1).float_matrix_value ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
269 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
270 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
271 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
272 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
273 cbb = args(1).complex_matrix_value ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
274 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
275 bb = args(1).matrix_value ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
276 }
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3911
diff changeset
277
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
278 // balance the GEP
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
279 if (isfloat)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
280 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
281 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
282 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
283 FloatComplexGEPBALANCE result (fcaa, fcbb, bal_job);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
284
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
285 switch (nargout)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
286 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
287 case 4:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
288 retval(3) = result.balanced_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
289 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
290 case 3:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
291 retval(2) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
292 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
293 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
294 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
295 case 2:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
296 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
297 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
298 case 1:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
299 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
300 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
301 default:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
302 error ("balance: invalid number of output arguments");
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
303 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
304 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
305 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
306 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
307 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
308 FloatGEPBALANCE result (faa, fbb, bal_job);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
309
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
310 switch (nargout)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
311 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
312 case 4:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
313 retval(3) = result.balanced_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
314 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
315 case 3:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
316 retval(2) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
317 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
318 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
319 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
320 case 2:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
321 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
322 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
323 case 1:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
324 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
325 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
326 default:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
327 error ("balance: invalid number of output arguments");
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
328 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
329 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
330 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
331 }
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
332 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
333 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
334 if (complex_case)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
335 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
336 ComplexGEPBALANCE result (caa, cbb, bal_job);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
337
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
338 switch (nargout)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
339 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
340 case 4:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
341 retval(3) = result.balanced_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
342 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
343 case 3:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
344 retval(2) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
345 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
346 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
347 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
348 case 2:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
349 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
350 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
351 case 1:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
352 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
353 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
354 default:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
355 error ("balance: invalid number of output arguments");
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
356 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
357 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
358 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
359 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
360 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
361 GEPBALANCE result (aa, bb, bal_job);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7482
diff changeset
362
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
363 switch (nargout)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
364 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
365 case 4:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
366 retval(3) = result.balanced_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
367 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
368 case 3:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
369 retval(2) = result.balanced_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
370 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
371 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
372 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
373 case 2:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
374 retval(1) = result.balancing_matrix2 ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
375 // fall through
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
376 case 1:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
377 retval(0) = result.balancing_matrix ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
378 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
379 default:
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
380 error ("balance: invalid number of output arguments");
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
381 break;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
382 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
383 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9821
diff changeset
384 }
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
385 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3181
diff changeset
386
2928
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
387 return retval;
295f037b4b3e [project @ 1997-05-05 05:32:33 by jwe]
jwe
parents:
diff changeset
388 }