Mercurial > octave
annotate liboctave/numeric/gsvd.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 | 18fac4a92fa6 |
children | aac27ad79be6 |
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:
30394
diff
changeset
|
3 // Copyright (C) 1997-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 //////////////////////////////////////////////////////////////////////// |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
25 |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
26 #ifdef HAVE_CONFIG_H |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
27 # include <config.h> |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
28 #endif |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
29 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
30 #include <algorithm> |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
31 #include <unordered_map> |
22436
09005ac7d56c
gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents:
22402
diff
changeset
|
32 |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
33 #include "CMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
34 #include "dDiagMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
35 #include "dMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
36 #include "fCMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
37 #include "fDiagMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
38 #include "fMatrix.h" |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
39 #include "gsvd.h" |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
40 #include "lo-error.h" |
22322
93b3cdd36854
move most f77 function decls to separate header files
John W. Eaton <jwe@octave.org>
parents:
22297
diff
changeset
|
41 #include "lo-lapack-proto.h" |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
42 #include "oct-locbuf.h" |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
43 #include "oct-shlib.h" |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
44 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
45 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
46 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
47 static std::unordered_map<std::string, void *> gsvd_fcn; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
48 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
49 static bool have_DGGSVD3 = false; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
50 static bool gsvd_initialized = false; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
51 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
52 /* Hack to stringize results of F77_FUNC macro. */ |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
53 #define xSTRINGIZE(x) #x |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
54 #define STRINGIZE(x) xSTRINGIZE(x) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
55 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
56 static void initialize_gsvd (void) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
57 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
58 if (gsvd_initialized) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
59 return; |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
60 |
27102
84ff9953faa1
where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
27101
diff
changeset
|
61 dynamic_library libs (""); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
62 if (! libs) |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
63 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
64 ("gsvd: unable to query LAPACK library"); |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
65 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
66 have_DGGSVD3 = (libs.search (STRINGIZE (F77_FUNC (dggsvd3, DGGSVD3))) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
67 != nullptr); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
68 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
69 if (have_DGGSVD3) |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
70 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
71 gsvd_fcn["dg"] = libs.search (STRINGIZE (F77_FUNC (dggsvd3, DGGSVD3))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
72 gsvd_fcn["sg"] = libs.search (STRINGIZE (F77_FUNC (sggsvd3, SGGSVD3))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
73 gsvd_fcn["zg"] = libs.search (STRINGIZE (F77_FUNC (zggsvd3, ZGGSVD3))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
74 gsvd_fcn["cg"] = libs.search (STRINGIZE (F77_FUNC (cggsvd3, CGGSVD3))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
75 } |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
76 else |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
77 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 gsvd_fcn["dg"] = libs.search (STRINGIZE (F77_FUNC (dggsvd, DGGSVD))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
79 gsvd_fcn["sg"] = libs.search (STRINGIZE (F77_FUNC (sggsvd, SGGSVD))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
80 gsvd_fcn["zg"] = libs.search (STRINGIZE (F77_FUNC (zggsvd, ZGGSVD))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
81 gsvd_fcn["cg"] = libs.search (STRINGIZE (F77_FUNC (cggsvd, CGGSVD))); |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
82 } |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
83 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
84 gsvd_initialized = true; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
85 } |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
86 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
87 /* Clean up macro namespace as soon as we are done using them */ |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
88 #undef xSTRINGIZE |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
89 #undef STRINGIZE |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
90 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
91 template<class T1> |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
92 struct real_ggsvd_ptr |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
93 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
94 typedef F77_RET_T (*type) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
95 (F77_CONST_CHAR_ARG_DECL, // JOBU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
96 F77_CONST_CHAR_ARG_DECL, // JOBV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
97 F77_CONST_CHAR_ARG_DECL, // JOBQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
98 const F77_INT&, // M |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
99 const F77_INT&, // N |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
100 const F77_INT&, // P |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
101 F77_INT&, // K |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
102 F77_INT&, // L |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
103 T1 *, // A(LDA,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
104 const F77_INT&, // LDA |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
105 T1 *, // B(LDB,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
106 const F77_INT&, // LDB |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
107 T1 *, // ALPHA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
108 T1 *, // BETA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
109 T1 *, // U(LDU,M) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
110 const F77_INT&, // LDU |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
111 T1 *, // V(LDV,P) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
112 const F77_INT&, // LDV |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
113 T1 *, // Q(LDQ,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
114 const F77_INT&, // LDQ |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
115 T1 *, // WORK |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
116 F77_INT *, // IWORK(N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
117 F77_INT& // INFO |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
118 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
119 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
120 F77_CHAR_ARG_LEN_DECL); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
121 }; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
122 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
123 template<class T1> |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
124 struct real_ggsvd3_ptr |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
125 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
126 typedef F77_RET_T (*type) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
127 (F77_CONST_CHAR_ARG_DECL, // JOBU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
128 F77_CONST_CHAR_ARG_DECL, // JOBV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
129 F77_CONST_CHAR_ARG_DECL, // JOBQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
130 const F77_INT&, // M |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
131 const F77_INT&, // N |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
132 const F77_INT&, // P |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
133 F77_INT&, // K |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
134 F77_INT&, // L |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
135 T1 *, // A(LDA,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
136 const F77_INT&, // LDA |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
137 T1 *, // B(LDB,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
138 const F77_INT&, // LDB |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
139 T1 *, // ALPHA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
140 T1 *, // BETA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
141 T1 *, // U(LDU,M) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
142 const F77_INT&, // LDU |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
143 T1 *, // V(LDV,P) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
144 const F77_INT&, // LDV |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
145 T1 *, // Q(LDQ,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
146 const F77_INT&, // LDQ |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
147 T1 *, // WORK |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
148 const F77_INT&, // LWORK |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
149 F77_INT *, // IWORK(N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
150 F77_INT& // INFO |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
151 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
152 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
153 F77_CHAR_ARG_LEN_DECL); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
154 }; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
155 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
156 template<class T1, class T2> |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
157 struct comp_ggsvd_ptr |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
158 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
159 typedef F77_RET_T (*type) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
160 (F77_CONST_CHAR_ARG_DECL, // JOBU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
161 F77_CONST_CHAR_ARG_DECL, // JOBV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
162 F77_CONST_CHAR_ARG_DECL, // JOBQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
163 const F77_INT&, // M |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
164 const F77_INT&, // N |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
165 const F77_INT&, // P |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
166 F77_INT&, // K |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
167 F77_INT&, // L |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
168 T1 *, // A(LDA,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
169 const F77_INT&, // LDA |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
170 T1 *, // B(LDB,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
171 const F77_INT&, // LDB |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
172 T2 *, // ALPHA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
173 T2 *, // BETA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
174 T1 *, // U(LDU,M) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
175 const F77_INT&, // LDU |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
176 T1 *, // V(LDV,P) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
177 const F77_INT&, // LDV |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
178 T1 *, // Q(LDQ,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
179 const F77_INT&, // LDQ |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
180 T1 *, // WORK |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
181 T2 *, // RWORK |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
182 F77_INT *, // IWORK(N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
183 F77_INT& // INFO |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
184 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
185 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
186 F77_CHAR_ARG_LEN_DECL); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
187 }; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
188 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
189 template<class T1, class T2> |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
190 struct comp_ggsvd3_ptr |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
191 { |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
192 typedef F77_RET_T (*type) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
193 (F77_CONST_CHAR_ARG_DECL, // JOBU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
194 F77_CONST_CHAR_ARG_DECL, // JOBV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
195 F77_CONST_CHAR_ARG_DECL, // JOBQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
196 const F77_INT&, // M |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
197 const F77_INT&, // N |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
198 const F77_INT&, // P |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
199 F77_INT&, // K |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
200 F77_INT&, // L |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
201 T1 *, // A(LDA,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
202 const F77_INT&, // LDA |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
203 T1 *, // B(LDB,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
204 const F77_INT&, // LDB |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
205 T2 *, // ALPHA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
206 T2 *, // BETA(N) |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
207 T1 *, // U(LDU,M) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
208 const F77_INT&, // LDU |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
209 T1 *, // V(LDV,P) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
210 const F77_INT&, // LDV |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
211 T1 *, // Q(LDQ,N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
212 const F77_INT&, // LDQ |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
213 T1 *, // WORK |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
214 const F77_INT&, // LWORK |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
215 T2 *, // RWORK |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
216 F77_INT *, // IWORK(N) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
217 F77_INT& // INFO |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
218 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
219 F77_CHAR_ARG_LEN_DECL |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
220 F77_CHAR_ARG_LEN_DECL); |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
221 }; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
222 |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
223 // template specializations |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
224 typedef real_ggsvd_ptr<F77_DBLE>::type dggsvd_type; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
225 typedef real_ggsvd3_ptr<F77_DBLE>::type dggsvd3_type; |
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
226 typedef real_ggsvd_ptr<F77_REAL>::type sggsvd_type; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
227 typedef real_ggsvd3_ptr<F77_REAL>::type sggsvd3_type; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
228 typedef comp_ggsvd_ptr<F77_DBLE_CMPLX, F77_DBLE>::type zggsvd_type; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
229 typedef comp_ggsvd3_ptr<F77_DBLE_CMPLX, F77_DBLE>::type zggsvd3_type; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
230 typedef comp_ggsvd_ptr<F77_CMPLX, F77_REAL>::type cggsvd_type; |
27101
097774bed4ed
move some static functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
231 typedef comp_ggsvd3_ptr<F77_CMPLX, F77_REAL>::type cggsvd3_type; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
232 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
233 OCTAVE_BEGIN_NAMESPACE(math) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
234 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
235 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
236 void |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
237 gsvd<Matrix>::ggsvd (char& jobu, char& jobv, char& jobq, F77_INT m, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
238 F77_INT n, F77_INT p, F77_INT& k, F77_INT& l, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
239 double *tmp_dataA, F77_INT m1, double *tmp_dataB, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
240 F77_INT p1, Matrix& alpha, Matrix& beta, double *u, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
241 F77_INT nrow_u, double *v, F77_INT nrow_v, double *q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
242 F77_INT nrow_q, double *work, F77_INT lwork, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
243 F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
244 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
245 if (! gsvd_initialized) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
246 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
247 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
248 if (have_DGGSVD3) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
249 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
250 dggsvd3_type f_ptr = reinterpret_cast<dggsvd3_type> (gsvd_fcn["dg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
251 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
252 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
253 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
254 m, n, p, k, l, tmp_dataA, m1, tmp_dataB, p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
255 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
256 u, nrow_u, v, nrow_v, q, nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
257 work, lwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
258 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
259 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
260 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
261 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
262 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
263 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
264 dggsvd_type f_ptr = reinterpret_cast<dggsvd_type> (gsvd_fcn["dg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
265 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
266 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
267 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
268 m, n, p, k, l, tmp_dataA, m1, tmp_dataB, p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
269 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
270 u, nrow_u, v, nrow_v, q, nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
271 work, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
272 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
273 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
274 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
275 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
276 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
277 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
278 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
279 void |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
280 gsvd<FloatMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, F77_INT m, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
281 F77_INT n, F77_INT p, F77_INT& k, F77_INT& l, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
282 float *tmp_dataA, F77_INT m1, float *tmp_dataB, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
283 F77_INT p1, FloatMatrix& alpha, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
284 FloatMatrix& beta, float *u, F77_INT nrow_u, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
285 float *v, F77_INT nrow_v, float *q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
286 F77_INT nrow_q, float *work, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
287 F77_INT lwork, F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
288 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
289 if (! gsvd_initialized) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
290 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
291 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
292 if (have_DGGSVD3) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
293 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
294 sggsvd3_type f_ptr = reinterpret_cast<sggsvd3_type> (gsvd_fcn["sg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
295 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
296 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
297 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
298 m, n, p, k, l, tmp_dataA, m1, tmp_dataB, p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
299 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
300 u, nrow_u, v, nrow_v, q, nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
301 work, lwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
302 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
303 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
304 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
305 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
306 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
307 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
308 sggsvd_type f_ptr = reinterpret_cast<sggsvd_type> (gsvd_fcn["sg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
309 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
310 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
311 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
312 m, n, p, k, l, tmp_dataA, m1, tmp_dataB, p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
313 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
314 u, nrow_u, v, nrow_v, q, nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
315 work, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
316 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
317 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
318 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
319 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
320 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
321 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
322 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
323 void |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
324 gsvd<ComplexMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
325 F77_INT m, F77_INT n, F77_INT p, F77_INT& k, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
326 F77_INT& l, Complex *tmp_dataA, F77_INT m1, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
327 Complex *tmp_dataB, F77_INT p1, Matrix& alpha, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
328 Matrix& beta, Complex *u, F77_INT nrow_u, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
329 Complex *v, F77_INT nrow_v, Complex *q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
330 F77_INT nrow_q, Complex *work, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
331 F77_INT lwork, F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
332 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
333 if (! gsvd_initialized) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
334 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
335 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
336 OCTAVE_LOCAL_BUFFER(double, rwork, 2*n); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
337 |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
338 if (have_DGGSVD3) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
339 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
340 zggsvd3_type f_ptr = reinterpret_cast<zggsvd3_type> (gsvd_fcn["zg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
341 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
342 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
343 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
344 m, n, p, k, l, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
345 F77_DBLE_CMPLX_ARG (tmp_dataA), m1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
346 F77_DBLE_CMPLX_ARG (tmp_dataB), p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
347 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
348 F77_DBLE_CMPLX_ARG (u), nrow_u, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
349 F77_DBLE_CMPLX_ARG (v), nrow_v, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
350 F77_DBLE_CMPLX_ARG (q), nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
351 F77_DBLE_CMPLX_ARG (work), |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
352 lwork, rwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
353 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
354 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
355 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
356 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
357 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
358 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
359 zggsvd_type f_ptr = reinterpret_cast<zggsvd_type> (gsvd_fcn["zg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
360 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
361 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
362 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
363 m, n, p, k, l, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
364 F77_DBLE_CMPLX_ARG (tmp_dataA), m1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
365 F77_DBLE_CMPLX_ARG (tmp_dataB), p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
366 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
367 F77_DBLE_CMPLX_ARG (u), nrow_u, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
368 F77_DBLE_CMPLX_ARG (v), nrow_v, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
369 F77_DBLE_CMPLX_ARG (q), nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
370 F77_DBLE_CMPLX_ARG (work), |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
371 rwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
372 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
373 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
374 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
375 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
376 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
377 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
378 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
379 void |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
380 gsvd<FloatComplexMatrix>::ggsvd (char& jobu, char& jobv, char& jobq, |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
381 F77_INT m, F77_INT n, F77_INT p, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
382 F77_INT& k, F77_INT& l, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
383 FloatComplex *tmp_dataA, F77_INT m1, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
384 FloatComplex *tmp_dataB, F77_INT p1, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
385 FloatMatrix& alpha, FloatMatrix& beta, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
386 FloatComplex *u, F77_INT nrow_u, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
387 FloatComplex *v, F77_INT nrow_v, |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
388 FloatComplex *q, F77_INT nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
389 FloatComplex *work, F77_INT lwork, |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
390 F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
391 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
392 if (! gsvd_initialized) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
393 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
394 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
395 OCTAVE_LOCAL_BUFFER(float, rwork, 2*n); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
396 |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
397 if (have_DGGSVD3) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
398 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
399 cggsvd3_type f_ptr = reinterpret_cast<cggsvd3_type> (gsvd_fcn["cg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
400 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
401 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
402 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
403 m, n, p, k, l, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
404 F77_CMPLX_ARG (tmp_dataA), m1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
405 F77_CMPLX_ARG (tmp_dataB), p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
406 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
407 F77_CMPLX_ARG (u), nrow_u, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
408 F77_CMPLX_ARG (v), nrow_v, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
409 F77_CMPLX_ARG (q), nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
410 F77_CMPLX_ARG (work), lwork, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
411 rwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
412 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
413 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
414 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
415 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
416 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
417 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
418 cggsvd_type f_ptr = reinterpret_cast<cggsvd_type> (gsvd_fcn["cg"]); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
419 f_ptr (F77_CONST_CHAR_ARG2 (&jobu, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
420 F77_CONST_CHAR_ARG2 (&jobv, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
421 F77_CONST_CHAR_ARG2 (&jobq, 1), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
422 m, n, p, k, l, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
423 F77_CMPLX_ARG (tmp_dataA), m1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
424 F77_CMPLX_ARG (tmp_dataB), p1, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
425 alpha.fortran_vec (), beta.fortran_vec (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
426 F77_CMPLX_ARG (u), nrow_u, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
427 F77_CMPLX_ARG (v), nrow_v, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
428 F77_CMPLX_ARG (q), nrow_q, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
429 F77_CMPLX_ARG (work), |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
430 rwork, iwork, info |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
431 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
432 F77_CHAR_ARG_LEN (1) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
433 F77_CHAR_ARG_LEN (1)); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
434 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
435 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
436 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
437 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
438 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
439 gsvd<T>::left_singular_matrix_A (void) const |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
440 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
441 if (m_type == gsvd::Type::sigma_only) |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
442 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
443 ("gsvd: U not computed because type == gsvd::sigma_only"); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
444 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
445 return m_left_smA; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
446 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
447 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
448 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
449 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
450 gsvd<T>::left_singular_matrix_B (void) const |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
451 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
452 if (m_type == gsvd::Type::sigma_only) |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
453 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
454 ("gsvd: V not computed because type == gsvd::sigma_only"); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
455 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
456 return m_left_smB; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
457 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
458 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
459 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
460 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
461 gsvd<T>::right_singular_matrix (void) const |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
462 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
463 if (m_type == gsvd::Type::sigma_only) |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
464 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
465 ("gsvd: X not computed because type == gsvd::sigma_only"); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
466 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
467 return m_right_sm; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
468 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
469 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
470 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
471 gsvd<T>::gsvd (const T& a, const T& b, gsvd::Type gsvd_type) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
472 { |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
473 if (a.isempty () || b.isempty ()) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
474 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
475 ("gsvd: A and B cannot be empty matrices"); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
476 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
477 F77_INT info; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
478 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23475
diff
changeset
|
479 F77_INT m = to_f77_int (a.rows ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23475
diff
changeset
|
480 F77_INT n = to_f77_int (a.cols ()); |
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23475
diff
changeset
|
481 F77_INT p = to_f77_int (b.rows ()); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
482 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
483 T atmp = a; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
484 P *tmp_dataA = atmp.fortran_vec (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
485 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
486 T btmp = b; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
487 P *tmp_dataB = btmp.fortran_vec (); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
488 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
489 char jobu = 'U'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
490 char jobv = 'V'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
491 char jobq = 'Q'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
492 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
493 F77_INT nrow_u = m; |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
494 F77_INT nrow_v = p; |
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
495 F77_INT nrow_q = n; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
496 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
497 F77_INT k, l; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
498 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
499 switch (gsvd_type) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
500 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
501 case gsvd<T>::Type::sigma_only: |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
502 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
503 // FIXME: In LAPACK 3.0, problem below seems to be fixed, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
504 // so we now set jobX = 'N'. |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
505 // |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
506 // For calculating sigma_only, both jobu and jobv should be 'N', but |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
507 // there seems to be a bug in dgesvd from LAPACK V2.0. To |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
508 // demonstrate the bug, set both jobu and jobv to 'N' and find the |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
509 // singular values of [eye(3), eye(3)]. The result is |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
510 // [-sqrt(2), -sqrt(2), -sqrt(2)]. |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
511 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
512 jobu = jobv = jobq = 'N'; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
513 nrow_u = nrow_v = nrow_q = 1; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
514 break; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
515 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
516 default: |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
517 break; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
518 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
519 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
520 m_type = gsvd_type; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
521 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
522 if (jobu != 'N') |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
523 m_left_smA.resize (nrow_u, m); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
524 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
525 P *u = m_left_smA.fortran_vec (); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
526 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
527 if (jobv != 'N') |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
528 m_left_smB.resize (nrow_v, p); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
529 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
530 P *v = m_left_smB.fortran_vec (); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
531 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
532 if (jobq != 'N') |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
533 m_right_sm.resize (nrow_q, n); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
534 |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
535 P *q = m_right_sm.fortran_vec (); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
536 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
537 real_matrix alpha (n, 1); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
538 real_matrix beta (n, 1); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
539 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
540 OCTAVE_LOCAL_BUFFER(F77_INT, iwork, n); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
541 |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
542 if (! gsvd_initialized) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
543 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
544 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
545 F77_INT lwork; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
546 if (have_DGGSVD3) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
547 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
548 lwork = -1; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
549 P work_tmp; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
550 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
551 gsvd<T>::ggsvd (jobu, jobv, jobq, m, n, p, k, l, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
552 tmp_dataA, m, tmp_dataB, p, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
553 alpha, beta, u, nrow_u, v, nrow_v, q, nrow_q, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
554 &work_tmp, lwork, iwork, info); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
555 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
556 lwork = static_cast<F77_INT> (std::abs (work_tmp)); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
557 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
558 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
559 { |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
560 lwork = std::max ({3*n, m, p}) + n; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
561 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
562 info = 0; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
563 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
564 OCTAVE_LOCAL_BUFFER(P, work, lwork); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
565 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
566 gsvd<T>::ggsvd (jobu, jobv, jobq, m, n, p, k, l, |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
567 tmp_dataA, m, tmp_dataB, p, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
568 alpha, beta, u, nrow_u, v, nrow_v, q, nrow_q, |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
569 work, lwork, iwork, info); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
570 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
571 if (info < 0) |
29417
a6ab7069a87c
Use matching format string for Fortran integers.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
572 (*current_liboctave_error_handler) |
31368
18fac4a92fa6
build: Silence compilation warning about mismatching integer format (bug #63290).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
573 ("*ggsvd.f: argument %" OCTAVE_F77_INT_TYPE_FORMAT " illegal", |
18fac4a92fa6
build: Silence compilation warning about mismatching integer format (bug #63290).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
574 -info); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
575 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
576 if (info > 0) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
577 (*current_liboctave_error_handler) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
578 ("*ggsvd.f: Jacobi-type procedure failed to converge"); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
579 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
580 F77_INT i, j; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
581 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
582 if (gsvd_type != gsvd<T>::Type::sigma_only) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
583 { |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
584 // Size according to LAPACK is k+l,k+l, but this needs |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
585 // to be nxn for Matlab compatibility. |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
586 T R (n, n, 0.0); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
587 int astart = n-k-l; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
588 if (m - k - l >= 0) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
589 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
590 // R is stored in A(1:K+L,N-K-L+1:N) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
591 for (i = 0; i < k+l; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
592 for (j = 0; j < k+l; j++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
593 R.xelem (i, j) = atmp.xelem (i, astart + j); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
594 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
595 else |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
596 { |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
597 // (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
598 // ( 0 R22 R23 ) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
599 for (i = 0; i < m; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
600 for (j = 0; j < k+l; j++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
601 R.xelem (i, j) = atmp.xelem (i, astart + j); |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
602 // and R33 is stored in B(M-K+1:L,N+M-K-L+1:N) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
603 for (i = m; i < k + l; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
604 for (j = n - l - k + m; j < n; j++) |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
605 R.xelem (i, j) = btmp.xelem (i - k, j); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
606 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
607 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
608 // Output X = Q*R' |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
609 // FIXME: Is there a way to call BLAS multiply directly |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
610 // with flags so that R is transposed? |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
611 m_right_sm = m_right_sm * R.hermitian (); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
612 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
613 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
614 // Fill in C and S |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
615 F77_INT rank; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
616 bool fill_ptn; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
617 if (m-k-l >= 0) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
618 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
619 rank = l; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
620 fill_ptn = true; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
621 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
622 else |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
623 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
624 rank = m-k; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
625 fill_ptn = false; |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
626 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
627 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
628 if (gsvd_type == gsvd<T>::Type::sigma_only) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
629 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
630 // Return column vector with results |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
631 m_sigmaA.resize (k+l, 1); |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
632 m_sigmaB.resize (k+l, 1); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
633 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
634 if (fill_ptn) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
635 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
636 for (i = 0; i < k; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
637 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
638 m_sigmaA.xelem (i) = 1.0; |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
639 m_sigmaB.xelem (i) = 0.0; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
640 } |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
641 for (i = k, j = k+l-1; i < k+l; i++, j--) |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
642 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
643 m_sigmaA.xelem (i) = alpha.xelem (i); |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
644 m_sigmaB.xelem (i) = beta.xelem (i); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
645 } |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
646 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
647 else |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
648 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
649 for (i = 0; i < k; i++) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
650 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
651 m_sigmaA.xelem (i) = 1.0; |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
652 m_sigmaB.xelem (i) = 0.0; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
653 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
654 for (i = k; i < m; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
655 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
656 m_sigmaA.xelem (i) = alpha.xelem (i); |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
657 m_sigmaB.xelem (i) = beta.xelem (i); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
658 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
659 for (i = m; i < k+l; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
660 { |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
661 m_sigmaA.xelem (i) = 0.0; |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
662 m_sigmaB.xelem (i) = 1.0; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
663 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
664 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
665 } |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
666 else // returning all matrices |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
667 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
668 // Number of columns according to LAPACK is k+l, but this needs |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
669 // to be n for Matlab compatibility. |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
670 m_sigmaA.resize (m, n); |
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
671 m_sigmaB.resize (p, n); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
672 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
673 for (i = 0; i < k; i++) |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
674 m_sigmaA.xelem (i, i) = 1.0; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
675 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
676 for (i = 0; i < rank; i++) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
677 { |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
678 m_sigmaA.xelem (k+i, k+i) = alpha.xelem (k+i); |
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30302
diff
changeset
|
679 m_sigmaB.xelem (i, k+i) = beta.xelem (k+i); |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
680 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
681 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
682 if (! fill_ptn) |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
683 { |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
684 for (i = m; i < n; i++) |
30302
4fa09c269dde
maint: use "m_" prefix for member variables in class gsvd.
Rik <rik@octave.org>
parents:
30300
diff
changeset
|
685 m_sigmaB.xelem (i-k, i) = 1.0; |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
686 } |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
687 |
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
688 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
689 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
690 |
30300
4ee01c14fccd
Rewrite gsvd function and return *correct* 3rd output (bug #60273).
Rik <rik@octave.org>
parents:
29417
diff
changeset
|
691 // Instantiations needed in octave::math namespace. |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
692 template class gsvd<Matrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
693 template class gsvd<FloatMatrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
694 template class gsvd<ComplexMatrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
695 template class gsvd<FloatComplexMatrix>; |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
696 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
697 OCTAVE_END_NAMESPACE(math) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31368
diff
changeset
|
698 OCTAVE_END_NAMESPACE(octave) |