Mercurial > octave
annotate liboctave/numeric/gsvd.cc @ 24677:69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
* oct-shlib.cc, oct-shlib.h: Make search_all_loaded a protected property. Fix
destructors.
* gsvd.cc: Don't use a static dynamic_library object.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 02 Feb 2018 22:31:29 +0100 |
parents | f0de21a6a426 |
children | 6652d3823428 |
rev | line source |
---|---|
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
1 /* |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
2 |
23221
debe0c7dcefc
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
22988
diff
changeset
|
3 Copyright (C) 2016-2017 Barbara Lócsi |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
4 Copyright (C) 2006 Pascal Dupuis <Pascal.Dupuis@uclouvain.be> |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
5 Copyright (C) 1996, 1997 John W. Eaton |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
6 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
7 This file is part of Octave. |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
8 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
9 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
10 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
12 (at your option) any later version. |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
13 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
14 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
15 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
17 GNU General Public License for more details. |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
18 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
20 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24520
diff
changeset
|
21 <https://www.gnu.org/licenses/>. |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
22 |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22437
diff
changeset
|
23 */ |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
24 |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
25 #ifdef HAVE_CONFIG_H |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
26 # include <config.h> |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
27 #endif |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
28 |
22436
09005ac7d56c
gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents:
22402
diff
changeset
|
29 #include <vector> |
09005ac7d56c
gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents:
22402
diff
changeset
|
30 |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
31 #include "CMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
32 #include "dDiagMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
33 #include "dMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
34 #include "fCMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
35 #include "fDiagMatrix.h" |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23450
diff
changeset
|
36 #include "fMatrix.h" |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
37 #include "gsvd.h" |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
38 #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
|
39 #include "lo-lapack-proto.h" |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
40 #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
|
41 |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
42 static std::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
|
43 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
44 static bool have_DGGSVD3 = false; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
45 static bool gsvd_initialized = false; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
46 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
47 /* Hack to stringize macro results. */ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
48 #define xSTRINGIZE(x) #x |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
49 #define STRINGIZE(x) xSTRINGIZE(x) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
50 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
51 void initialize_gsvd (void) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
52 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
53 if (gsvd_initialized) |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
54 return; |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
55 |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
56 octave::dynamic_library libs (""); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
57 if (! libs) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
58 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
59 // FIXME: Should we throw an error if we cannot check the libraries? |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
60 have_DGGSVD3 = false; |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
61 return; |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
62 } |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
63 |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
64 have_DGGSVD3 = (libs.search (STRINGIZE (F77_FUNC (dggsvd3, DGGSVD3))) |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
65 != nullptr); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
66 |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
67 if (have_DGGSVD3) |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
68 { |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
69 gsvd_fcn["dg"] = libs.search (STRINGIZE (F77_FUNC (dggsvd3, DGGSVD3))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
70 gsvd_fcn["sg"] = libs.search (STRINGIZE (F77_FUNC (sggsvd3, SGGSVD3))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
71 gsvd_fcn["zg"] = libs.search (STRINGIZE (F77_FUNC (zggsvd3, ZGGSVD3))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
72 gsvd_fcn["cg"] = libs.search (STRINGIZE (F77_FUNC (cggsvd3, CGGSVD3))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
73 } |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
74 else |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
75 { |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
76 gsvd_fcn["dg"] = libs.search (STRINGIZE (F77_FUNC (dggsvd, DGGSVD))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
77 gsvd_fcn["sg"] = libs.search (STRINGIZE (F77_FUNC (sggsvd, SGGSVD))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
78 gsvd_fcn["zg"] = libs.search (STRINGIZE (F77_FUNC (zggsvd, ZGGSVD))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
79 gsvd_fcn["cg"] = libs.search (STRINGIZE (F77_FUNC (cggsvd, CGGSVD))); |
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
80 } |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
81 gsvd_initialized = true; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
82 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
83 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
84 template<class T1> |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
85 struct real_ggsvd_ptr |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
86 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
87 typedef F77_RET_T (*type) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
88 (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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 const F77_INT&, // P |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
94 F77_INT &, // K |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
95 F77_INT &, // L |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
96 T1*, // A(LDA,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
97 const F77_INT&, // LDA |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
98 T1*, // B(LDB,N) |
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&, // LDB |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
100 T1*, // ALPHA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
101 T1*, // BETA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
102 T1*, // U(LDU,M) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
103 const F77_INT&, // LDU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
104 T1*, // V(LDV,P) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
105 const F77_INT&, // LDV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
106 T1*, // Q(LDQ,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
107 const F77_INT&, // LDQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
108 T1*, // WORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
109 F77_INT*, // IWORK(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 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
|
114 }; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
115 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
116 template<class T1> |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
117 struct real_ggsvd3_ptr |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
118 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
119 typedef F77_RET_T (*type) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
120 (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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 const F77_INT&, // P |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
126 F77_INT &, // K |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
127 F77_INT &, // L |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
128 T1*, // A(LDA,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
129 const F77_INT&, // LDA |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
130 T1*, // B(LDB,N) |
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&, // LDB |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
132 T1*, // ALPHA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
133 T1*, // BETA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
134 T1*, // U(LDU,M) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
135 const F77_INT&, // LDU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
136 T1*, // V(LDV,P) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
137 const F77_INT&, // LDV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
138 T1*, // Q(LDQ,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
139 const F77_INT&, // LDQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
140 T1*, // WORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
141 const 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
|
142 F77_INT*, // IWORK(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 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
|
147 }; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
148 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
149 template<class T1, class T2> |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
150 struct comp_ggsvd_ptr |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
151 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
152 typedef F77_RET_T (*type) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
153 (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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 const F77_INT&, // P |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
159 F77_INT &, // K |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
160 F77_INT &, // L |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
161 T1*, // A(LDA,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
162 const F77_INT&, // LDA |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
163 T1*, // B(LDB,N) |
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&, // LDB |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
165 T2*, // ALPHA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
166 T2*, // BETA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
167 T1*, // U(LDU,M) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
168 const F77_INT&, // LDU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
169 T1*, // V(LDV,P) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
170 const F77_INT&, // LDV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
171 T1*, // Q(LDQ,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
172 const F77_INT&, // LDQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
173 T1*, // WORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
174 T2*, // RWORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
175 F77_INT*, // IWORK(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 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
|
180 }; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
181 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
182 template<class T1, class T2> |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
183 struct comp_ggsvd3_ptr |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
184 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
185 typedef F77_RET_T (*type) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
186 (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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 const F77_INT&, // P |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
192 F77_INT &, // K |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
193 F77_INT &, // L |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
194 T1*, // A(LDA,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
195 const F77_INT&, // LDA |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
196 T1*, // B(LDB,N) |
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&, // LDB |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
198 T2*, // ALPHA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
199 T2*, // BETA(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
200 T1*, // U(LDU,M) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
201 const F77_INT&, // LDU |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
202 T1*, // V(LDV,P) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
203 const F77_INT&, // LDV |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
204 T1*, // Q(LDQ,N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
205 const F77_INT&, // LDQ |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
206 T1*, // WORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
207 const 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
|
208 T2*, // RWORK |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
209 F77_INT*, // IWORK(N) |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 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
|
214 }; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
215 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
216 // template specializations |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
217 typedef real_ggsvd3_ptr<F77_DBLE>::type dggsvd3_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
218 typedef real_ggsvd_ptr<F77_DBLE>::type dggsvd_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
219 typedef real_ggsvd3_ptr<F77_REAL>::type sggsvd3_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
220 typedef real_ggsvd_ptr<F77_REAL>::type sggsvd_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
221 typedef comp_ggsvd3_ptr<F77_DBLE_CMPLX, F77_DBLE>::type zggsvd3_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
222 typedef comp_ggsvd_ptr<F77_DBLE_CMPLX, F77_DBLE>::type zggsvd_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
223 typedef comp_ggsvd3_ptr<F77_CMPLX, F77_REAL>::type cggsvd3_type; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
224 typedef comp_ggsvd_ptr<F77_CMPLX, F77_REAL>::type cggsvd_type; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
225 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
226 namespace octave |
22436
09005ac7d56c
gsvd<T>: add class template support for FloatMatrix and FloatComplexMatrix.
Carnë Draug <carandraug@octave.org>
parents:
22402
diff
changeset
|
227 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
228 namespace math |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
229 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
230 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 F77_INT nrow_u, double *v, F77_INT nrow_v, double *q, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
237 F77_INT nrow_q, Matrix& work, 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
|
238 F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
239 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
240 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
|
241 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
242 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
243 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
|
244 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 u, nrow_u, v, nrow_v, q, nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
252 work.fortran_vec (), lwork, iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
257 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
258 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 u, nrow_u, v, nrow_v, q, nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
266 work.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
267 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
|
268 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
|
269 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
|
270 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
271 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
272 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
273 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
274 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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 float *v, F77_INT nrow_v, float *q, |
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 nrow_q, FloatMatrix& work, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
282 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
|
283 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
284 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
|
285 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
286 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
287 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
|
288 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 u, nrow_u, v, nrow_v, q, nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
296 work.fortran_vec (), lwork, iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
297 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
|
298 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
|
299 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
|
300 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
301 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
302 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 u, nrow_u, v, nrow_v, q, nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
310 work.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
315 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
316 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
317 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
318 void |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 Complex *v, F77_INT nrow_v, Complex *q, |
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 nrow_q, ComplexMatrix& work, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
326 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
|
327 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
328 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
|
329 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
330 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
331 Matrix rwork(2*n, 1); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
332 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
|
333 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 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
|
343 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
|
344 F77_DBLE_CMPLX_ARG (q), nrow_q, |
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 (work.fortran_vec ()), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
346 lwork, rwork.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
347 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
|
348 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
|
349 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
|
350 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
351 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
352 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 F77_DBLE_CMPLX_ARG (q), nrow_q, |
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 (work.fortran_vec ()), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
365 rwork.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
366 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
|
367 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
|
368 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
|
369 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
370 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
371 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
372 template <> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
373 void |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 FloatComplex *q, F77_INT nrow_q, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
383 FloatComplexMatrix& work, F77_INT lwork, |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23221
diff
changeset
|
384 F77_INT *iwork, F77_INT& info) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
385 { |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
386 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
|
387 initialize_gsvd (); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
388 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
389 FloatMatrix rwork(2*n, 1); |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
390 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
|
391 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
392 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
|
393 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
|
394 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
|
395 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
|
396 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
|
397 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
|
398 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
|
399 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
|
400 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
|
401 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
|
402 F77_CMPLX_ARG (q), nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
403 F77_CMPLX_ARG (work.fortran_vec ()), lwork, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
404 rwork.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
405 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
|
406 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
|
407 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
|
408 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
409 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
410 { |
24677
69b89e81d3d3
Fix unloading dynamic libraries (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24653
diff
changeset
|
411 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
|
412 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 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
|
418 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
|
419 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
|
420 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
|
421 F77_CMPLX_ARG (q), nrow_q, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
422 F77_CMPLX_ARG (work.fortran_vec ()), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
423 rwork.fortran_vec (), iwork, info |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
428 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
429 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
430 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
431 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
432 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
|
433 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
434 if (type == gsvd::Type::sigma_only) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
435 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
436 (*current_liboctave_error_handler) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
437 ("gsvd: U not computed because type == gsvd::sigma_only"); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
438 return T (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
439 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
440 else |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
441 return left_smA; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
442 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
443 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
444 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
445 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
446 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
|
447 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
448 if (type == gsvd::Type::sigma_only) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
449 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
450 (*current_liboctave_error_handler) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
451 ("gsvd: V not computed because type == gsvd::sigma_only"); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
452 return T (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
453 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
454 else |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
455 return left_smB; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
456 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
457 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
458 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
459 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
460 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
|
461 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
462 if (type == gsvd::Type::sigma_only) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
463 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
464 (*current_liboctave_error_handler) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
465 ("gsvd: X not computed because type == gsvd::sigma_only"); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
466 return T (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
467 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
468 else |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
469 return right_sm; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
470 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
471 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
472 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
473 T |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
474 gsvd<T>::R_matrix (void) const |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
475 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
476 if (type != gsvd::Type::std) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
477 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
478 (*current_liboctave_error_handler) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
479 ("gsvd: R not computed because type != gsvd::std"); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
480 return T (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
481 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
482 else |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
483 return R; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
484 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
485 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
486 template <typename T> |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
487 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
|
488 { |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
489 F77_INT info; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
490 |
23696
08036a7f3660
remove octave:: namespace tag from symbols used inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23475
diff
changeset
|
491 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
|
492 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
|
493 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
|
494 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
495 T atmp = a; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
496 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
|
497 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
498 T btmp = b; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
499 P *tmp_dataB = btmp.fortran_vec (); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
500 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
501 char jobu = 'U'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
502 char jobv = 'V'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
503 char jobq = 'Q'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
504 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
505 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
|
506 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
|
507 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
|
508 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
509 F77_INT k, l; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
510 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
511 switch (gsvd_type) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
512 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
513 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
|
514 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
515 // Note: for this case, both jobu and jobv should be 'N', but |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
516 // there seems to be a bug in dgesvd from Lapack V2.0. To |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
517 // demonstrate the bug, set both jobu and jobv to 'N' and find |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
518 // the singular values of [eye(3), eye(3)]. The result is |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
519 // [-sqrt(2), -sqrt(2), -sqrt(2)]. |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
520 // |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
521 // For Lapack 3.0, this problem seems to be fixed. |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
522 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
523 jobu = 'N'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
524 jobv = 'N'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
525 jobq = 'N'; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
526 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
|
527 break; |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
528 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
529 default: |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
530 break; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
531 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
532 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
533 type = gsvd_type; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
534 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
535 if (! (jobu == 'N' || jobu == 'O')) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
536 left_smA.resize (nrow_u, m); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
537 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
538 P *u = left_smA.fortran_vec (); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
539 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
540 if (! (jobv == 'N' || jobv == 'O')) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
541 left_smB.resize (nrow_v, p); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
542 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
543 P *v = left_smB.fortran_vec (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
544 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
545 if (! (jobq == 'N' || jobq == 'O')) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
546 right_sm.resize (nrow_q, n); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
547 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
548 P *q = right_sm.fortran_vec (); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
549 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
550 real_matrix alpha (n, 1); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
551 real_matrix beta (n, 1); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
552 |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
553 std::vector<F77_INT> iwork (n); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
554 |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
555 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
|
556 initialize_gsvd (); |
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 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
|
559 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
|
560 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
561 lwork = -1; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
562 T work_tmp (1, 1); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
563 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
564 gsvd<T>::ggsvd (jobu, jobv, jobq, 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
|
565 tmp_dataA, m, tmp_dataB, p, alpha, beta, u, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
566 nrow_u, v, nrow_v, q, nrow_q, work_tmp, lwork, |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
567 iwork.data (), info); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
568 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
569 lwork = static_cast<F77_INT> (std::abs (work_tmp(0, 0))); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
570 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
571 else |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
572 { |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
573 lwork = 3*n; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
574 lwork = (lwork > m ? lwork : m); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
575 lwork = (lwork > p ? lwork : p) + n; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
576 } |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
577 info = 0; |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
578 |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
579 T work (lwork, 1); |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
580 |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
581 gsvd<T>::ggsvd (jobu, jobv, jobq, m, n, p, k, l, |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
582 tmp_dataA, m, tmp_dataB, p, alpha, beta, u, |
24653
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
583 nrow_u, v, nrow_v, q, nrow_q, work, lwork, iwork.data (), |
f0de21a6a426
Use new LAPACK functions in gsvd if available (bug #50463).
Markus Mützel <markus.muetzel@gmx.de>
parents:
24534
diff
changeset
|
584 info); |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
585 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
586 if (info < 0) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
587 (*current_liboctave_error_handler) ("*ggsvd.f: argument %d illegal", |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
588 -info); |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
589 else |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
590 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
591 if (info > 0) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
592 (*current_liboctave_error_handler) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
593 ("*ggsvd.f: Jacobi-type procedure failed to converge."); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
594 else |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
595 { |
22945
eb01d0178188
use F77_INT instead of octave_idx_type for liboctave gsvd class
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
596 F77_INT i, j; |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
597 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
598 if (gsvd<T>::Type::std == gsvd_type) |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
599 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
600 R.resize(k+l, k+l); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
601 int astart = n-k-l; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
602 if (m - k - l >= 0) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
603 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
604 astart = n-k-l; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
605 // R is stored in A(1:K+L,N-K-L+1:N) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
606 for (i = 0; i < k+l; i++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
607 for (j = 0; j < k+l; j++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
608 R.xelem (i, j) = atmp.xelem (i, astart + j); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
609 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
610 else |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
611 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
612 // (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
613 // ( 0 R22 R23 ) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
614 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
615 for (i = 0; i < m; i++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
616 for (j = 0; j < k+l; j++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
617 R.xelem (i, j) = atmp.xelem (i, astart + j); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
618 // and R33 is stored in B(M-K+1:L,N+M-K-L+1:N) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
619 for (i = k+l-1; i >=m; i--) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
620 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
621 for (j = 0; j < m; j++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
622 R.xelem(i, j) = 0.0; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
623 for (j = m; j < k+l; j++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
624 R.xelem (i, j) = btmp.xelem (i - k, astart + j); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
625 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
626 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
627 } |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
628 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
629 if (m-k-l >= 0) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
630 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
631 // Fills in C and S |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
632 sigmaA.resize (l, l); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
633 sigmaB.resize (l, l); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
634 for (i = 0; i < l; i++) |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
635 { |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
636 sigmaA.dgxelem(i) = alpha.elem(k+i); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
637 sigmaB.dgxelem(i) = beta.elem(k+i); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
638 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
639 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
640 else |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
641 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
642 // Fills in C and S |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
643 sigmaA.resize (m-k, m-k); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
644 sigmaB.resize (m-k, m-k); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
645 for (i = 0; i < m-k; i++) |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
646 { |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
647 sigmaA.dgxelem(i) = alpha.elem(k+i); |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
648 sigmaB.dgxelem(i) = beta.elem(k+i); |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
649 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
650 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
651 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
652 } |
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
653 } |
22437
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
654 |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
655 // Instantiations we need. |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
656 template class gsvd<Matrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
657 template class gsvd<FloatMatrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
658 template class gsvd<ComplexMatrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
659 template class gsvd<FloatComplexMatrix>; |
0aee8b620864
gsvd: move new class into the octave::math namespace.
Carnë Draug <carandraug@octave.org>
parents:
22436
diff
changeset
|
660 } |
22236
065a44375723
gsvd: reduce code duplication with templates.
Barbara Locsi <locsi.barbara@gmail.com>
parents:
diff
changeset
|
661 } |