annotate libinterp/corefcn/qz.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30390
diff changeset
3 // Copyright (C) 1998-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
25
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
26 // Generalized eigenvalue balancing via LAPACK
3911
8389e78e67d4 [project @ 2002-04-28 02:15:38 by jwe]
jwe
parents: 3887
diff changeset
27
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
28 // Originally written by A. S. Hodel <scotte@eng.auburn.edu>, but is
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
29 // substantially different with the change to use LAPACK.
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
30
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
31 #undef DEBUG
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
32 #undef DEBUG_SORT
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
33 #undef DEBUG_EIG
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
34
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
35 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21279
diff changeset
36 # include "config.h"
9786
2c279308f6ab fix includes in some src/DLD-FUNCTIONS files
John W. Eaton <jwe@octave.org>
parents: 9758
diff changeset
37 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
38
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
39 #include <cctype>
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
40 #include <cmath>
4051
b79da8779a0e [project @ 2002-08-17 19:38:32 by jwe]
jwe
parents: 3911
diff changeset
41
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
42 #if defined (DEBUG_EIG)
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
43 # include <iomanip>
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
44 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
45
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4051
diff changeset
46 #include "f77-fcn.h"
22322
93b3cdd36854 move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents: 22317
diff changeset
47 #include "lo-lapack-proto.h"
21279
eb1524b07fe3 better use of templates for qr classes
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
48 #include "qr.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4051
diff changeset
49 #include "quit.h"
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4051
diff changeset
50
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14876
diff changeset
51 #include "defun.h"
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
52 #include "error.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21024
diff changeset
53 #include "errwarn.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20892
diff changeset
54 #include "ovl.h"
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
55 #if defined (DEBUG) || defined (DEBUG_SORT)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
56 # include "pager.h"
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21110
diff changeset
57 # include "pr-output.h"
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
58 #endif
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
59
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
60 OCTAVE_BEGIN_NAMESPACE(octave)
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29558
diff changeset
61
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
62 // FIXME: Matlab does not produce lambda as the first output argument.
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
63 // Compatibility problem?
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
64
15039
e753177cde93 maint: Move non-dynamically linked functions from DLD-FUNCTIONS/ to corefcn/ directory
Rik <rik@octave.org>
parents: 14876
diff changeset
65 DEFUN (qz, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
66 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
67 @deftypefn {} {@var{lambda} =} qz (@var{A}, @var{B})
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
68 @deftypefnx {} {[@var{AA}, @var{BB}, @var{Q}, @var{Z}, @var{V}, @var{W}, @var{lambda}] =} qz (@var{A}, @var{B})
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
69 @deftypefnx {} {[@var{AA}, @var{BB}, @var{Z}] =} qz (@var{A}, @var{B}, @var{opt})
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
70 @deftypefnx {} {[@var{AA}, @var{BB}, @var{Z}, @var{lambda}] =} qz (@var{A}, @var{B}, @var{opt})
25106
d7ad543255c5 doc: Shorten very long first sentences of docstrings (bug #53388).
Rik <rik@octave.org>
parents: 25103
diff changeset
71 Compute the QZ@tie{}decomposition of a generalized eigenvalue problem.
d7ad543255c5 doc: Shorten very long first sentences of docstrings (bug #53388).
Rik <rik@octave.org>
parents: 25103
diff changeset
72
d7ad543255c5 doc: Shorten very long first sentences of docstrings (bug #53388).
Rik <rik@octave.org>
parents: 25103
diff changeset
73 The generalized eigenvalue problem is defined as
d7ad543255c5 doc: Shorten very long first sentences of docstrings (bug #53388).
Rik <rik@octave.org>
parents: 25103
diff changeset
74
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
75 @tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
76 $$A x = \lambda B x$$
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
77 @end tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
78 @ifnottex
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
79
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
80 @math{A x = @var{lambda} B x}
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
81
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
82 @end ifnottex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
83
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
84 There are three calling forms of the function:
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
85
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
86 @enumerate
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
87 @item @code{@var{lambda} = qz (@var{A}, @var{B})}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
88
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
89 Compute the generalized eigenvalues
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
90 @tex
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
91 $\lambda.$
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
92 @end tex
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
93 @ifnottex
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
94 @var{lambda}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
95 @end ifnottex
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
96
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
97 @item @code{[@var{AA}, @var{BB}, @var{Q}, @var{Z}, @var{V}, @var{W}, @var{lambda}] = qz (@var{A}, @var{B})}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
98
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
99 Compute QZ@tie{}decomposition, generalized eigenvectors, and generalized
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
100 eigenvalues.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
101 @tex
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
102 $$ AA = Q^T AZ, BB = Q^T BZ $$
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
103 $$ AV = BV{ \rm diag }(\lambda) $$
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
104 $$ W^T A = { \rm diag }(\lambda)W^T B $$
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
105 @end tex
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
106 @ifnottex
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
107
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
108 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
109 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
110
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
111 @var{AA} = @var{Q} * @var{A} * @var{Z}, @var{BB} = @var{Q} * @var{B} * @var{Z}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
112 @var{A} * @var{V} = @var{B} * @var{V} * diag (@var{lambda})
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
113 @var{W}' * @var{A} = diag (@var{lambda}) * @var{W}' * @var{B}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
114
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
115 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
116 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
117
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
118 @end ifnottex
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
119 with @var{Q} and @var{Z} orthogonal (unitary for complex case).
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
120
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
121 @item @code{[@var{AA}, @var{BB}, @var{Z} @{, @var{lambda}@}] = qz (@var{A}, @var{B}, @var{opt})}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
122
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
123 As in form 2 above, but allows ordering of generalized eigenpairs for, e.g.,
25003
2365c2661b3c doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents: 24534
diff changeset
124 solution of discrete time algebraic @nospell{Riccati} equations. Form 3 is not
2365c2661b3c doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents: 24534
diff changeset
125 available for complex matrices, and does not compute the generalized
2365c2661b3c doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents: 24534
diff changeset
126 eigenvectors @var{V}, @var{W}, nor the orthogonal matrix @var{Q}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
127
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
128 @table @var
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
129 @item opt
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
130 for ordering eigenvalues of the @nospell{GEP} pencil. The leading block of
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
131 the revised pencil contains all eigenvalues that satisfy:
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
132
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
133 @table @asis
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
134 @item @qcode{"N"}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
135 unordered (default)
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
136
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
137 @item @qcode{"S"}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
138 small: leading block has all
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
139 @tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
140 $|\lambda| < 1$
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
141 @end tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
142 @ifnottex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
143 |@var{lambda}| < 1
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
144 @end ifnottex
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
145
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
146 @item @qcode{"B"}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
147 big: leading block has all
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
148 @tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
149 $|\lambda| \geq 1$
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
150 @end tex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
151 @ifnottex
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
152 |@var{lambda}| @geq{} 1
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
153 @end ifnottex
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
154
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
155 @item @qcode{"-"}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
156 negative real part: leading block has all eigenvalues in the open left
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
157 half-plane
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
158
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
159 @item @qcode{"+"}
23428
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
160 non-negative real part: leading block has all eigenvalues in the closed right
1bc0e610e293 doc: Redo docstring for qz (bug #50846).
Rik <rik@octave.org>
parents: 23219
diff changeset
161 half-plane
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
162 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
163 @end table
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
164 @end enumerate
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
165
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
166 Note: @code{qz} performs permutation balancing, but not scaling
28961
d9d028b479ac doc: Use @code{} within alternate text for @xref,@pxref macros in libinterp/
Rik <rik@octave.org>
parents: 27923
diff changeset
167 (@pxref{XREFbalance,,@code{balance}}), which may be lead to less accurate
d9d028b479ac doc: Use @code{} within alternate text for @xref,@pxref macros in libinterp/
Rik <rik@octave.org>
parents: 27923
diff changeset
168 results than @code{eig}. The order of output arguments was selected for
d9d028b479ac doc: Use @code{} within alternate text for @xref,@pxref macros in libinterp/
Rik <rik@octave.org>
parents: 27923
diff changeset
169 compatibility with @sc{matlab}.
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
170 @seealso{eig, gsvd, balance, chol, hess, lu, qr, qzhess, schur}
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
171 @end deftypefn */)
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
172 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
173 int nargin = args.length ();
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
174
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
175 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
176 octave_stdout << "qz: nargin = " << nargin
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
177 << ", nargout = " << nargout << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
178 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
179
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
180 if (nargin < 2 || nargin > 3 || nargout > 7)
20802
8bb38ba1bad6 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
181 print_usage ();
8bb38ba1bad6 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
182
8bb38ba1bad6 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20700
diff changeset
183 if (nargin == 3 && (nargout < 3 || nargout > 4))
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
184 error ("qz: invalid number of output arguments for form 3 call");
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
185
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
186 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
187 octave_stdout << "qz: determine ordering option" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
188 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
189
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
190 // Determine ordering option.
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
191
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
192 char ord_job = 'N';
24116
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
193 double safmin = 0.0;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
194
24116
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
195 if (nargin == 3)
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
196 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
197 std::string opt = args(2).xstring_value ("qz: OPT must be a string");
8927
d75f4ee0538d qz.cc (Fqz): avoid maybe clobbred by vfork warning from GCC
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
198
24116
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
199 if (opt.empty ())
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
200 error ("qz: OPT must be a non-empty string");
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
201
e1020353fff5 qz: initialize optional ordering flag safely
Mike Miller <mtmiller@octave.org>
parents: 23826
diff changeset
202 ord_job = std::toupper (opt[0]);
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
203
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
204 std::string valid_opts = "NSB+-";
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
205
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
206 if (valid_opts.find_first_of (ord_job) == std::string::npos)
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
207 error ("qz: invalid order option '%c'", ord_job);
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
208
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
209 // overflow constant required by dlag2
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4153
diff changeset
210 F77_FUNC (xdlamch, XDLAMCH) (F77_CONST_CHAR_ARG2 ("S", 1),
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
211 safmin
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
212 F77_CHAR_ARG_LEN (1));
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
213
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
214 #if defined (DEBUG_EIG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
215 octave_stdout << "qz: initial value of safmin="
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
216 << setiosflags (std::ios::scientific)
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
217 << safmin << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
218 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
219
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
220 // Some machines (e.g., DEC alpha) get safmin = 0;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
221 // for these, use eps instead to avoid problems in dlag2.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
222 if (safmin == 0)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
223 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
224 #if defined (DEBUG_EIG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
225 octave_stdout << "qz: DANGER WILL ROBINSON: safmin is 0!"
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
226 << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
227 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
228
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
229 F77_FUNC (xdlamch, XDLAMCH) (F77_CONST_CHAR_ARG2 ("E", 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
230 safmin
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
231 F77_CHAR_ARG_LEN (1));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
232
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
233 #if defined (DEBUG_EIG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
234 octave_stdout << "qz: safmin set to "
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
235 << setiosflags (std::ios::scientific)
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
236 << safmin << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
237 #endif
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
238 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
239 }
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
240
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
241 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
242 octave_stdout << "qz: check matrix A" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
243 #endif
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
244
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
245 // Matrix A: check dimensions.
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
246 F77_INT nn = to_f77_int (args(0).rows ());
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
247 F77_INT nc = to_f77_int (args(0).columns ());
20892
c07bee629973 2015 Code Sprint: use ovl ().
Rik <rik@octave.org>
parents: 20853
diff changeset
248
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
249 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
250 octave_stdout << "Matrix A dimensions: (" << nn << ',' << nc << ')'
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
251 << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
252 #endif
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
253
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23477
diff changeset
254 if (args(0).isempty ())
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
255 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
256 warn_empty_arg ("qz: A");
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
257 return octave_value_list (2, Matrix ());
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
258 }
22964
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
259 else if (nc != nn)
21110
3d0d84305600 Use err_square_matrix_required more widely.
Rik <rik@octave.org>
parents: 21100
diff changeset
260 err_square_matrix_required ("qz", "A");
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
261
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
262 // Matrix A: get value.
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
263 Matrix aa;
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
264 ComplexMatrix caa;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
265
23581
c3075ae020e1 maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents: 23577
diff changeset
266 if (args(0).iscomplex ())
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
267 caa = args(0).complex_matrix_value ();
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
268 else
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
269 aa = args(0).matrix_value ();
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
270
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
271 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
272 octave_stdout << "qz: check matrix B" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
273 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
274
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
275 // Extract argument 2 (bb, or cbb if complex).
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
276 F77_INT b_nr = to_f77_int (args(1).rows ());
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
277 F77_INT b_nc = to_f77_int (args(1).columns ());
22964
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
278
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
279 if (nn != b_nc || nn != b_nr)
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29558
diff changeset
280 ::err_nonconformant ();
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
281
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
282 Matrix bb;
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
283 ComplexMatrix cbb;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
284
23581
c3075ae020e1 maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents: 23577
diff changeset
285 if (args(1).iscomplex ())
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
286 cbb = args(1).complex_matrix_value ();
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
287 else
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
288 bb = args(1).matrix_value ();
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
289
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
290 // Both matrices loaded, now check whether to calculate complex or real val.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
291
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
292 bool complex_case = (args(0).iscomplex () || args(1).iscomplex ());
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
293
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
294 if (nargin == 3 && complex_case)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
295 error ("qz: cannot re-order complex qz decomposition");
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
296
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
297 // First, declare variables used in both the real and complex cases.
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
298 // FIXME: There are a lot of excess variables declared.
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
299 // Probably a better way to handle this.
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
300 Matrix QQ (nn, nn), ZZ (nn, nn), VR (nn, nn), VL (nn, nn);
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
301 RowVector alphar (nn), alphai (nn), betar (nn);
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
302 ComplexRowVector xalpha (nn), xbeta (nn);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
303 ComplexMatrix CQ (nn, nn), CZ (nn, nn), CVR (nn, nn), CVL (nn, nn);
22964
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
304 F77_INT ilo, ihi, info;
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
305 char comp_q = (nargout >= 3 ? 'V' : 'N');
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
306 char comp_z = ((nargout >= 4 || nargin == 3)? 'V' : 'N');
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
307
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
308 // Initialize Q, Z to identity matrix if either is needed
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
309 if (comp_q == 'V' || comp_z == 'V')
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
310 {
23477
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
311 double *QQptr = QQ.fortran_vec ();
3530b956d707 maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
312 double *ZZptr = ZZ.fortran_vec ();
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
313 std::fill_n (QQptr, QQ.numel (), 0.0);
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
314 std::fill_n (ZZptr, ZZ.numel (), 0.0);
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
315 for (F77_INT i = 0; i < nn; i++)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
316 {
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
317 QQ(i, i) = 1.0;
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
318 ZZ(i, i) = 1.0;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
319 }
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
320 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
321
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
322 // Always perform permutation balancing.
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4153
diff changeset
323 const char bal_job = 'P';
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
324 RowVector lscale (nn), rscale (nn), work (6 * nn), rwork (nn);
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
325
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
326 if (complex_case)
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
327 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
328 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
329 if (comp_q == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
330 octave_stdout << "qz: performing balancing; CQ =\n" << CQ << std::endl;
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
331 #endif
23582
0cc2011d800e maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents: 23581
diff changeset
332 if (args(0).isreal ())
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
333 caa = ComplexMatrix (aa);
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
334
23582
0cc2011d800e maint: Deprecate is_real_type and replace with isreal.
Rik <rik@octave.org>
parents: 23581
diff changeset
335 if (args(1).isreal ())
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
336 cbb = ComplexMatrix (bb);
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
337
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
338 if (comp_q == 'V')
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
339 CQ = ComplexMatrix (QQ);
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
340
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
341 if (comp_z == 'V')
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
342 CZ = ComplexMatrix (ZZ);
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
343
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
344 F77_XFCN (zggbal, ZGGBAL,
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
345 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
346 nn, F77_DBLE_CMPLX_ARG (caa.fortran_vec ()), nn,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
347 F77_DBLE_CMPLX_ARG (cbb.fortran_vec ()),
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
348 nn, ilo, ihi, lscale.fortran_vec (),
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
349 rscale.fortran_vec (), work.fortran_vec (), info
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
350 F77_CHAR_ARG_LEN (1)));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
351 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
352 else
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
353 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
354 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
355 if (comp_q == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
356 octave_stdout << "qz: performing balancing; QQ =\n" << QQ << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
357 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
358
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
359 F77_XFCN (dggbal, DGGBAL,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
360 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
361 nn, aa.fortran_vec (), nn, bb.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
362 nn, ilo, ihi, lscale.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
363 rscale.fortran_vec (), work.fortran_vec (), info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
364 F77_CHAR_ARG_LEN (1)));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
365 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
366
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
367 // Only permutation balance above is done. Skip scaling balance.
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
368
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
369 #if 0
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
370 // Since we just want the balancing matrices, we can use dggbal
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
371 // for both the real and complex cases; left first
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
372
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
373 if (comp_q == 'V')
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
374 {
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
375 F77_XFCN (dggbak, DGGBAK,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
376 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
377 F77_CONST_CHAR_ARG2 ("L", 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
378 nn, ilo, ihi, lscale.data (), rscale.data (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
379 nn, QQ.fortran_vec (), nn, info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
380 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
381 F77_CHAR_ARG_LEN (1)));
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
382
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
383 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
384 if (comp_q == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
385 octave_stdout << "qz: balancing done; QQ =\n" << QQ << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
386 #endif
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
387 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
388
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
389 // then right
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
390 if (comp_z == 'V')
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
391 {
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4153
diff changeset
392 F77_XFCN (dggbak, DGGBAK,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
393 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
394 F77_CONST_CHAR_ARG2 ("R", 1),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
395 nn, ilo, ihi, lscale.data (), rscale.data (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
396 nn, ZZ.fortran_vec (), nn, info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
397 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
398 F77_CHAR_ARG_LEN (1)));
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
399
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
400 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
401 if (comp_z == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
402 octave_stdout << "qz: balancing done; ZZ=\n" << ZZ << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
403 #endif
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
404 }
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
405 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
406
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
407 char qz_job = (nargout < 2 ? 'E' : 'S');
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
408
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
409 if (complex_case)
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
410 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
411 // Complex case.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
412
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
413 // The QR decomposition of cbb.
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
414 math::qr<ComplexMatrix> cbqr (cbb);
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
415 // The R matrix of QR decomposition for cbb.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
416 cbb = cbqr.R ();
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
417 // (Q*)caa for following work.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
418 caa = (cbqr.Q ().hermitian ()) * caa;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
419 CQ = CQ * cbqr.Q ();
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
420
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
421 F77_XFCN (zgghrd, ZGGHRD,
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
422 (F77_CONST_CHAR_ARG2 (&comp_q, 1),
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
423 F77_CONST_CHAR_ARG2 (&comp_z, 1),
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
424 nn, ilo, ihi, F77_DBLE_CMPLX_ARG (caa.fortran_vec ()),
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
425 nn, F77_DBLE_CMPLX_ARG (cbb.fortran_vec ()), nn,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
426 F77_DBLE_CMPLX_ARG (CQ.fortran_vec ()), nn,
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
427 F77_DBLE_CMPLX_ARG (CZ.fortran_vec ()), nn, info
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
428 F77_CHAR_ARG_LEN (1)
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
429 F77_CHAR_ARG_LEN (1)));
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
430
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
431 ComplexRowVector cwork (nn);
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
432
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
433 F77_XFCN (zhgeqz, ZHGEQZ,
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
434 (F77_CONST_CHAR_ARG2 (&qz_job, 1),
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
435 F77_CONST_CHAR_ARG2 (&comp_q, 1),
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
436 F77_CONST_CHAR_ARG2 (&comp_z, 1),
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
437 nn, ilo, ihi,
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
438 F77_DBLE_CMPLX_ARG (caa.fortran_vec ()), nn,
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
439 F77_DBLE_CMPLX_ARG (cbb.fortran_vec ()), nn,
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
440 F77_DBLE_CMPLX_ARG (xalpha.fortran_vec ()),
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
441 F77_DBLE_CMPLX_ARG (xbeta.fortran_vec ()),
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
442 F77_DBLE_CMPLX_ARG (CQ.fortran_vec ()), nn,
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
443 F77_DBLE_CMPLX_ARG (CZ.fortran_vec ()), nn,
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
444 F77_DBLE_CMPLX_ARG (cwork.fortran_vec ()), nn,
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
445 rwork.fortran_vec (), info
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
446 F77_CHAR_ARG_LEN (1)
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
447 F77_CHAR_ARG_LEN (1)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
448 F77_CHAR_ARG_LEN (1)));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
449
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
450 if (comp_q == 'V')
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
451 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
452 // Left eigenvector.
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
453 F77_XFCN (zggbak, ZGGBAK,
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
454 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
455 F77_CONST_CHAR_ARG2 ("L", 1),
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
456 nn, ilo, ihi, lscale.data (), rscale.data (),
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
457 nn, F77_DBLE_CMPLX_ARG (CQ.fortran_vec ()), nn, info
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
458 F77_CHAR_ARG_LEN (1)
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
459 F77_CHAR_ARG_LEN (1)));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
460 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
461
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
462 if (comp_z == 'V')
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
463 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
464 // Right eigenvector.
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
465 F77_XFCN (zggbak, ZGGBAK,
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
466 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
467 F77_CONST_CHAR_ARG2 ("R", 1),
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
468 nn, ilo, ihi, lscale.data (), rscale.data (),
22135
407c66ae1e20 reduce warnings from GCC's link-time optimization feature (bug #48531)
John W. Eaton <jwe@octave.org>
parents: 22133
diff changeset
469 nn, F77_DBLE_CMPLX_ARG (CZ.fortran_vec ()), nn, info
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
470 F77_CHAR_ARG_LEN (1)
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
471 F77_CHAR_ARG_LEN (1)));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
472 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
473
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
474 }
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
475 else
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
476 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
477 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
478 octave_stdout << "qz: performing qr decomposition of bb" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
479 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
480
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
481 // Compute the QR factorization of bb.
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
482 math::qr<Matrix> bqr (bb);
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
483
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
484 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
485 octave_stdout << "qz: qr (bb) done; now performing qz decomposition"
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
486 << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
487 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
488
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
489 bb = bqr.R ();
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
490
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
491 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
492 octave_stdout << "qz: extracted bb" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
493 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
494
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
495 aa = (bqr.Q ()).transpose () * aa;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
496
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
497 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
498 octave_stdout << "qz: updated aa " << std::endl;
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
499 octave_stdout << "bqr.Q () =\n" << bqr.Q () << std::endl;
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
500
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
501 if (comp_q == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
502 octave_stdout << "QQ =" << QQ << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
503 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
504
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
505 if (comp_q == 'V')
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
506 QQ = QQ * bqr.Q ();
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
507
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
508 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
509 octave_stdout << "qz: precursors done..." << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
510 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
511
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
512 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
513 octave_stdout << "qz: comp_q = " << comp_q << ", comp_z = " << comp_z
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
514 << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
515 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
516
21562
6c2fd62db1f7 maint: Eliminate accidental double spaces in code.
Rik <rik@octave.org>
parents: 21301
diff changeset
517 // Reduce to generalized Hessenberg form.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
518 F77_XFCN (dgghrd, DGGHRD,
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
519 (F77_CONST_CHAR_ARG2 (&comp_q, 1),
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
520 F77_CONST_CHAR_ARG2 (&comp_z, 1),
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
521 nn, ilo, ihi, aa.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
522 nn, bb.fortran_vec (), nn, QQ.fortran_vec (), nn,
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
523 ZZ.fortran_vec (), nn, info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
524 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
525 F77_CHAR_ARG_LEN (1)));
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
526
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
527 // Check if just computing generalized eigenvalues,
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
528 // or if we're actually computing the decomposition.
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
529
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
530 // Reduce to generalized Schur form.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
531 F77_XFCN (dhgeqz, DHGEQZ,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
532 (F77_CONST_CHAR_ARG2 (&qz_job, 1),
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
533 F77_CONST_CHAR_ARG2 (&comp_q, 1),
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
534 F77_CONST_CHAR_ARG2 (&comp_z, 1),
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
535 nn, ilo, ihi, aa.fortran_vec (), nn, bb.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
536 nn, alphar.fortran_vec (), alphai.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
537 betar.fortran_vec (), QQ.fortran_vec (), nn,
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
538 ZZ.fortran_vec (), nn, work.fortran_vec (), nn, info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
539 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
540 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
541 F77_CHAR_ARG_LEN (1)));
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
542
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
543 if (comp_q == 'V')
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
544 {
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
545 F77_XFCN (dggbak, DGGBAK,
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
546 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
547 F77_CONST_CHAR_ARG2 ("L", 1),
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
548 nn, ilo, ihi, lscale.data (), rscale.data (),
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
549 nn, QQ.fortran_vec (), nn, info
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
550 F77_CHAR_ARG_LEN (1)
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
551 F77_CHAR_ARG_LEN (1)));
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
552
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
553 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
554 if (comp_q == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
555 octave_stdout << "qz: balancing done; QQ=\n" << QQ << std::endl;
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
556 #endif
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
557 }
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
558
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
559 // then right
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
560 if (comp_z == 'V')
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
561 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
562 F77_XFCN (dggbak, DGGBAK,
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
563 (F77_CONST_CHAR_ARG2 (&bal_job, 1),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 F77_CONST_CHAR_ARG2 ("R", 1),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 nn, ilo, ihi, lscale.data (), rscale.data (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
566 nn, ZZ.fortran_vec (), nn, info
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
567 F77_CHAR_ARG_LEN (1)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
568 F77_CHAR_ARG_LEN (1)));
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
569
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
570 #if defined (DEBUG)
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
571 if (comp_z == 'V')
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
572 octave_stdout << "qz: balancing done; ZZ=\n" << ZZ << std::endl;
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
573 #endif
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
574 }
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
575
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
576 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
577
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
578 // Order the QZ decomposition?
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
579 if (ord_job != 'N')
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
580 {
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
581 if (complex_case)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
582 // Probably not needed, but better be safe.
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
583 error ("qz: cannot re-order complex QZ decomposition");
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
584
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
585 #if defined (DEBUG_SORT)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
586 octave_stdout << "qz: ordering eigenvalues: ord_job = "
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
587 << ord_job << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
588 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
589
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
590 Array<F77_LOGICAL> select (dim_vector (nn, 1));
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
591
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
592 for (int j = 0; j < nn; j++)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
593 {
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
594 switch (ord_job)
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
595 {
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
596 case 'S':
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
597 select(j) = alphar(j)*alphar(j) + alphai(j)*alphai(j) < betar(j)*betar(j);
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
598 break;
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
599
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
600 case 'B':
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
601 select(j) = alphar(j)*alphar(j) + alphai(j)*alphai(j) >= betar(j)*betar(j);
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
602 break;
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
603
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
604 case '+':
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
605 select(j) = alphar(j) * betar(j) >= 0;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
606 break;
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
607
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
608 case '-':
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
609 select(j) = alphar(j) * betar(j) < 0;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
610 break;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
611
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
612 default:
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
613 // Invalid order option
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
614 // (should never happen since options were checked at the top).
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
615 panic_impossible ();
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
616 break;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
617 }
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
618 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
619
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
620 F77_LOGICAL wantq = 0, wantz = (comp_z == 'V');
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
621 F77_INT ijob = 0, mm, lrwork3 = 4*nn+16, liwork = nn;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
622 F77_DBLE pl, pr;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
623 RowVector rwork3(lrwork3);
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
624 Array<F77_INT> iwork (dim_vector (liwork, 1));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
625
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
626 F77_XFCN (dtgsen, DTGSEN,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
627 (ijob, wantq, wantz,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
628 select.fortran_vec (), nn,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
629 aa.fortran_vec (), nn,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
630 bb.fortran_vec (), nn,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
631 alphar.fortran_vec (),
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
632 alphai.fortran_vec (),
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
633 betar.fortran_vec (),
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
634 nullptr, nn,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
635 ZZ.fortran_vec (), nn,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
636 mm,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
637 pl, pr,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
638 nullptr,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
639 rwork3.fortran_vec (), lrwork3,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
640 iwork.fortran_vec (), liwork,
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
641 info));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
642
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
643 #if defined (DEBUG_SORT)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
644 octave_stdout << "qz: back from dtgsen: aa =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
645 octave_print_internal (octave_stdout, aa);
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
646 octave_stdout << "\nbb =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
647 octave_print_internal (octave_stdout, bb);
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
648 if (comp_z == 'V')
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
649 {
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
650 octave_stdout << "\nZZ =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
651 octave_print_internal (octave_stdout, ZZ);
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20802
diff changeset
652 }
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
653 octave_stdout << "\nqz: info=" << info;
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
654 octave_stdout << "\nalphar =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
655 octave_print_internal (octave_stdout, Matrix (alphar));
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
656 octave_stdout << "\nalphai =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
657 octave_print_internal (octave_stdout, Matrix (alphai));
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
658 octave_stdout << "\nbeta =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
659 octave_print_internal (octave_stdout, Matrix (betar));
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
660 octave_stdout << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
661 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
662 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
663
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
664 // Compute the generalized eigenvalues as well?
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
665 ComplexColumnVector gev;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
666
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
667 if (nargout < 2 || nargout == 7 || (nargin == 3 && nargout == 4))
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
668 {
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
669 if (complex_case)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
670 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
671 ComplexColumnVector tmp (nn);
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
672
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
673 for (F77_INT i = 0; i < nn; i++)
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
674 tmp(i) = xalpha(i) / xbeta(i);
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
675
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
676 gev = tmp;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
677 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
678 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
679 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
680 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
681 octave_stdout << "qz: computing generalized eigenvalues" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
682 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
683
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
684 // Return finite generalized eigenvalues.
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
685 ComplexColumnVector tmp (nn);
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
686
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
687 for (F77_INT i = 0; i < nn; i++)
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
688 {
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
689 if (betar(i) != 0)
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
690 tmp(i) = Complex (alphar(i), alphai(i)) / betar(i);
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
691 else
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
692 tmp(i) = numeric_limits<double>::Inf ();
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
693 }
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
694
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
695 gev = tmp;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
696 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
697 }
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
698
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
699 // Right, left eigenvector matrices.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
700 if (nargout >= 5)
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
701 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
702 // Which side to compute?
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
703 char side = (nargout == 5 ? 'R' : 'B');
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
704 // Compute all of them and backtransform
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
705 char howmany = 'B';
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
706 // Dummy pointer; select is not used.
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23449
diff changeset
707 F77_INT *select = nullptr;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
708
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
709 if (complex_case)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
710 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
711 CVL = CQ;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
712 CVR = CZ;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
713 ComplexRowVector cwork2 (2 * nn);
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
714 RowVector rwork2 (8 * nn);
22964
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
715 F77_INT m;
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
716
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
717 F77_XFCN (ztgevc, ZTGEVC,
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
718 (F77_CONST_CHAR_ARG2 (&side, 1),
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
719 F77_CONST_CHAR_ARG2 (&howmany, 1),
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
720 select, nn, F77_DBLE_CMPLX_ARG (caa.fortran_vec ()), nn,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
721 F77_DBLE_CMPLX_ARG (cbb.fortran_vec ()),
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
722 nn, F77_DBLE_CMPLX_ARG (CVL.fortran_vec ()), nn,
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22372
diff changeset
723 F77_DBLE_CMPLX_ARG (CVR.fortran_vec ()), nn, nn,
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
724 m, F77_DBLE_CMPLX_ARG (cwork2.fortran_vec ()),
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
725 rwork2.fortran_vec (), info
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
726 F77_CHAR_ARG_LEN (1)
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
727 F77_CHAR_ARG_LEN (1)));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
728 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
729 else
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
730 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
731 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
732 octave_stdout << "qz: computing generalized eigenvectors" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
733 #endif
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
734
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
735 VL = QQ;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
736 VR = ZZ;
22964
0c12642be005 use F77_INT instead of octave_idx_type for libinterp QZ function
John W. Eaton <jwe@octave.org>
parents: 22860
diff changeset
737 F77_INT m;
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
738
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
739 F77_XFCN (dtgevc, DTGEVC,
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
740 (F77_CONST_CHAR_ARG2 (&side, 1),
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
741 F77_CONST_CHAR_ARG2 (&howmany, 1),
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
742 select, nn, aa.fortran_vec (), nn, bb.fortran_vec (),
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
743 nn, VL.fortran_vec (), nn, VR.fortran_vec (), nn, nn,
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
744 m, work.fortran_vec (), info
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
745 F77_CHAR_ARG_LEN (1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
746 F77_CHAR_ARG_LEN (1)));
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
747
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
748 // Now construct the complex form of VV, WW.
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
749 F77_INT j = 0;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
750
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
751 while (j < nn)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
752 {
22860
0b1e25cc4457 eliminate use of OCTAVE_QUIT macro in C++ sources
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
753 octave_quit ();
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 4051
diff changeset
754
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
755 // See if real or complex eigenvalue.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
756
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
757 // Column increment; assume complex eigenvalue.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
758 int cinc = 2;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
759
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
760 if (j == (nn-1))
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
761 // Single column.
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
762 cinc = 1;
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
763 else if (aa(j+1, j) == 0)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
764 cinc = 1;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
765
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
766 // Now copy the eigenvector (s) to CVR, CVL.
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
767 if (cinc == 1)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
768 {
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
769 for (F77_INT i = 0; i < nn; i++)
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
770 CVR(i, j) = VR(i, j);
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
771
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
772 if (side == 'B')
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
773 for (F77_INT i = 0; i < nn; i++)
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
774 CVL(i, j) = VL(i, j);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
775 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
776 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
777 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
778 // Double column; complex vector.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
779
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
780 for (F77_INT i = 0; i < nn; i++)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
781 {
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
782 CVR(i, j) = Complex (VR(i, j), VR(i, j+1));
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
783 CVR(i, j+1) = Complex (VR(i, j), -VR(i, j+1));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
784 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
785
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
786 if (side == 'B')
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
787 for (F77_INT i = 0; i < nn; i++)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
788 {
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
789 CVL(i, j) = Complex (VL(i, j), VL(i, j+1));
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29961
diff changeset
790 CVL(i, j+1) = Complex (VL(i, j), -VL(i, j+1));
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
791 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
792 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
793
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
794 // Advance to next eigenvectors (if any).
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
795 j += cinc;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
796 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
797 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
798 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
799
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
800 octave_value_list retval (nargout);
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
801
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
802 switch (nargout)
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
803 {
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
804 case 7:
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
805 retval(6) = gev;
23826
d69021d58a61 avoid fallthrough warnings
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
806 OCTAVE_FALLTHROUGH;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
807
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
808 case 6:
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
809 // Return left eigenvectors.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
810 retval(5) = CVL;
23826
d69021d58a61 avoid fallthrough warnings
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
811 OCTAVE_FALLTHROUGH;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
812
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
813 case 5:
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
814 // Return right eigenvectors.
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
815 retval(4) = CVR;
23826
d69021d58a61 avoid fallthrough warnings
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
816 OCTAVE_FALLTHROUGH;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
817
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
818 case 4:
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
819 if (nargin == 3)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
820 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
821 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
822 octave_stdout << "qz: sort: retval(3) = gev =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
823 octave_print_internal (octave_stdout, ComplexMatrix (gev));
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
824 octave_stdout << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
825 #endif
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
826 retval(3) = gev;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 9786
diff changeset
827 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
828 else
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
829 {
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
830 if (complex_case)
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
831 retval(3) = CZ;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
832 else
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
833 retval(3) = ZZ;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
834 }
23826
d69021d58a61 avoid fallthrough warnings
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
835 OCTAVE_FALLTHROUGH;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
836
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
837 case 3:
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
838 if (nargin == 3)
14876
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
839 {
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
840 if (complex_case)
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
841 retval(2) = CZ;
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
842 else
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
843 retval(2) = ZZ;
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
844 }
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
845 else
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
846 {
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
847 if (complex_case)
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
848 retval(2) = CQ.hermitian ();
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
849 else
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
850 retval(2) = QQ.transpose ();
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
851 }
23826
d69021d58a61 avoid fallthrough warnings
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
852 OCTAVE_FALLTHROUGH;
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
853
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
854 case 2:
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
855 {
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
856 if (complex_case)
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
857 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
858 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
859 octave_stdout << "qz: retval(1) = cbb =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
860 octave_print_internal (octave_stdout, cbb);
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
861 octave_stdout << "\nqz: retval(0) = caa =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
862 octave_print_internal (octave_stdout, caa);
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
863 octave_stdout << std::endl;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
864 #endif
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
865 retval(1) = cbb;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
866 retval(0) = caa;
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
867 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
868 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
869 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
870 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
871 octave_stdout << "qz: retval(1) = bb =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
872 octave_print_internal (octave_stdout, bb);
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
873 octave_stdout << "\nqz: retval(0) = aa =\n";
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
874 octave_print_internal (octave_stdout, aa);
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
875 octave_stdout << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
876 #endif
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
877 retval(1) = bb;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
878 retval(0) = aa;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
879 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11570
diff changeset
880 }
10311
a217e1d74353 untabify qz.cc
John W. Eaton <jwe@octave.org>
parents: 10307
diff changeset
881 break;
10307
4e4270ab70d6 support complex case in qz
Jyh-miin Lin <jyhmiinlin@gmail.com>
parents: 10155
diff changeset
882
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
883 case 1:
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
884 case 0:
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
885 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
886 octave_stdout << "qz: retval(0) = gev = " << gev << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
887 #endif
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
888 retval(0) = gev;
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
889 break;
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
890
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
891 default:
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
892 error ("qz: too many return arguments");
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
893 break;
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
894 }
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
895
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21562
diff changeset
896 #if defined (DEBUG)
26001
acb4689aa5f2 * qz.cc: Use octave_stdout instead of std::cout for debugging messages.
John W. Eaton <jwe@octave.org>
parents: 25734
diff changeset
897 octave_stdout << "qz: exiting (at long last)" << std::endl;
3185
9580887dd160 [project @ 1998-09-26 02:45:55 by jwe]
jwe
parents: 3183
diff changeset
898 #endif
3183
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
899
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
900 return retval;
5edc539c2f80 [project @ 1998-09-25 03:37:22 by jwe]
jwe
parents:
diff changeset
901 }
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
902
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
903 /*
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
904 %!test
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
905 %! A = [1 2; 0 3];
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
906 %! B = [1 0; 0 0];
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
907 %! C = [0 1; 0 0];
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
908 %! assert (qz (A,B), [1; Inf]);
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
909 %! assert (qz (A,C), [Inf; Inf]);
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
910
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
911 ## Example 7.7.3 in Golub & Van Loan
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
912 %!test
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
913 %! a = [ 10 1 2;
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
914 %! 1 2 -1;
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
915 %! 1 1 2 ];
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
916 %! b = reshape (1:9, 3,3);
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
917 %! [aa, bb, q, z, v, w, lambda] = qz (a, b);
13088
4ffea87ad71b codesprint: Fix tolerance for qz.cc tests.
Ben Abbott <bpabbott@mac.com>
parents: 13074
diff changeset
918 %! assert (q * a * z, aa, norm (aa) * 1e-14);
4ffea87ad71b codesprint: Fix tolerance for qz.cc tests.
Ben Abbott <bpabbott@mac.com>
parents: 13074
diff changeset
919 %! assert (q * b * z, bb, norm (bb) * 1e-14);
29557
50aa945836c3 qz.cc: Let test pass with LAPACK 3.9.1 and earlier versions (bug #60357).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29556
diff changeset
920 %! is_finite = abs (lambda) < 1 / eps (max (a(:)));
50aa945836c3 qz.cc: Let test pass with LAPACK 3.9.1 and earlier versions (bug #60357).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29556
diff changeset
921 %! observed = (b * v * diag (lambda))(:,is_finite);
50aa945836c3 qz.cc: Let test pass with LAPACK 3.9.1 and earlier versions (bug #60357).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29556
diff changeset
922 %! assert (observed, (a*v)(:,is_finite), norm (observed) * 1e-14);
50aa945836c3 qz.cc: Let test pass with LAPACK 3.9.1 and earlier versions (bug #60357).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29556
diff changeset
923 %! observed = (diag (lambda) * w' * b)(is_finite,:);
50aa945836c3 qz.cc: Let test pass with LAPACK 3.9.1 and earlier versions (bug #60357).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29556
diff changeset
924 %! assert (observed, (w'*a)(is_finite,:), norm (observed) * 1e-13);
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
925
14876
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
926 %!test
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
927 %! A = [0, 0, -1, 0; 1, 0, 0, 0; -1, 0, -2, -1; 0, -1, 1, 0];
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
928 %! B = [0, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1];
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
929 %! [AA, BB, Q, Z1] = qz (A, B);
23430
32d532b8e7d0 qz.cc: Overhaul qz function.
Rik <rik@octave.org>
parents: 23429
diff changeset
930 %! [AA, BB, Z2] = qz (A, B, "-");
14876
54a386f2ac4e correcly compute Z for 3-output call to qz (bug #36728)
John W. Eaton <jwe@octave.org>
parents: 14844
diff changeset
931 %! assert (Z1, Z2);
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
932
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
933 %!test
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
934 %! A = [ -1.03428 0.24929 0.43205 -0.12860;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
935 %! 1.16228 0.27870 2.12954 0.69250;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
936 %! -0.51524 -0.34939 -0.77820 2.13721;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
937 %! -1.32941 2.11870 0.72005 1.00835 ];
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
938 %! B = [ 1.407302 -0.632956 -0.360628 0.068534;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
939 %! 0.149898 0.298248 0.991777 0.023652;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
940 %! 0.169281 -0.405205 -1.775834 1.511730;
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
941 %! 0.717770 1.291390 -1.766607 -0.531352 ];
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
942 %! [AA, BB, Z, lambda] = qz (A, B, "+");
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
943 %! assert (all (real (lambda(1:3)) >= 0));
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
944 %! assert (real (lambda(4) < 0));
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
945 %! [AA, BB, Z, lambda] = qz (A, B, "-");
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
946 %! assert (real (lambda(1) < 0));
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
947 %! assert (all (real (lambda(2:4)) >= 0));
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
948 %! [AA, BB, Z, lambda] = qz (A, B, "B");
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
949 %! assert (all (abs (lambda(1:3)) >= 1));
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
950 %! assert (abs (lambda(4) < 1));
25570
da2b38b7a077 Use LAPACK DTGSEN subrouting for ordered-qz computation (bug #53761)
Sébastien Villemot <sebastien@debian.org>
parents: 25106
diff changeset
951 %! [AA, BB, Z, lambda] = qz (A, B, "S");
29556
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
952 %! assert (abs (lambda(1) < 1));
d75aa2bf4915 qz.cc: return correct number of eigenvalues (bug #60357).
Rik <rik@octave.org>
parents: 29358
diff changeset
953 %! assert (all (abs (lambda(2:4)) >= 1));
13074
0b789a03bde1 codesprint: Add 3 tests for qz.cc
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 12642
diff changeset
954 */
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29558
diff changeset
955
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
956 OCTAVE_END_NAMESPACE(octave)