Mercurial > octave
annotate libinterp/corefcn/__eigs__.cc @ 29163:8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
* GLCanvas.cc, interpreter-qobject.cc, file-editor-tab.cc,
octave-qscintilla.cc, octave-qobject.cc, Cell.cc, __eigs__.cc,
__magick_read__.cc, __qp__.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
file-io.cc, graphics.cc, graphics.in.h, input.cc, interpreter.cc,
ls-mat-ascii.cc, lsode.cc, oct-handle.h, oct-map.cc, quad.cc, rand.cc,
sparse.cc, sub2ind.cc, toplev.cc, utils.cc, __init_gnuplot__.cc, __ode15__.cc,
cdef-object.cc, ov-base-diag.cc, ov-base-mat.cc, ov-base-sparse.cc,
ov-base.cc, ov-fcn-handle.cc, ov-java.cc, ov-perm.cc, ov-range.cc,
ov-re-diag.cc, ov-str-mat.cc, ov.cc, pt-assign.cc, pt-eval.cc, pt-idx.cc,
pt-jit.cc, pt.cc, Array-util.cc, randmtzig.cc:
Update naming conventions for exceptions to use initial letter of exception
type. For example, "execution_exception" is named "ee", "index_exception" is
"ie". Catch "const" exceptions where possible.
* gzip.cc: Add block to catch and throw interrupt_exceptions before having
a catch block "(...)" for everything else.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 08 Dec 2020 13:25:03 -0800 |
parents | aef839f40da2 |
children | 7854d5752dd2 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 // Copyright (C) 2005-2020 The Octave Project Developers |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
28 #endif |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
29 |
23024
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
30 #include <limits> |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
31 #include <string> |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
32 |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
33 #include "Matrix.h" |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
34 #include "eigs-base.h" |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
35 #include "unwind-prot.h" |
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
36 |
28024
c28b8ba841fb
move sparse functions from dldfcn to corefcn directory (bug #57459)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
37 #include "defun.h" |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
38 #include "error.h" |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
39 #include "errwarn.h" |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
40 #include "interpreter-private.h" |
21190
342764537e5a
don't install eigs-base.cc
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
41 #include "oct-map.h" |
342764537e5a
don't install eigs-base.cc
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
42 #include "ov.h" |
23024
a6a7b054e4ba
Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents:
22755
diff
changeset
|
43 #include "ovl.h" |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
44 #include "pager.h" |
23473
55916f99b8b6
prefer feval over do_multi_index_op
John W. Eaton <jwe@octave.org>
parents:
23457
diff
changeset
|
45 #include "parse.h" |
21190
342764537e5a
don't install eigs-base.cc
John W. Eaton <jwe@octave.org>
parents:
21109
diff
changeset
|
46 #include "variables.h" |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
47 |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
48 #if defined (HAVE_ARPACK) |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
49 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
50 // Global pointer for user defined function. |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
51 static octave_value eigs_fcn; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
52 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
53 // Have we warned about imaginary values returned from user function? |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
54 static bool warned_imaginary = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
56 // Is this a recursive call? |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 static int call_depth = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
58 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
59 ColumnVector |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
60 eigs_func (const ColumnVector& x, int& eigs_error) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
61 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
62 ColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
63 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
64 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
65 |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
66 if (eigs_fcn.is_defined ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
67 { |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
68 octave_value_list tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
69 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
70 try |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
71 { |
23478
bce43f1a3cce
* __eigs__.cc: Avoid deprecated function warnings.
John W. Eaton <jwe@octave.org>
parents:
23473
diff
changeset
|
72 tmp = octave::feval (eigs_fcn, args, 1); |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
73 } |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
74 catch (octave::execution_exception& ee) |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
75 { |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
76 err_user_supplied_eval (ee, "eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
77 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
78 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
79 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
80 { |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23478
diff
changeset
|
81 if (! warned_imaginary && tmp(0).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
82 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
83 warning ("eigs: ignoring imaginary part returned from user-supplied function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
84 warned_imaginary = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
85 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
86 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
87 retval = tmp(0).xvector_value ("eigs: evaluation of user-supplied function failed"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
88 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
89 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
90 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
91 eigs_error = 1; |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
92 err_user_supplied_eval ("eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
93 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
94 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
95 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
96 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
97 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
98 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
99 ComplexColumnVector |
23433
c9fab0bc983e
maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
100 eigs_complex_func (const ComplexColumnVector& x, int& eigs_error) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
101 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
102 ComplexColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
103 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
104 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
105 |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
106 if (eigs_fcn.is_defined ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
107 { |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
108 octave_value_list tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
109 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
110 try |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
111 { |
23478
bce43f1a3cce
* __eigs__.cc: Avoid deprecated function warnings.
John W. Eaton <jwe@octave.org>
parents:
23473
diff
changeset
|
112 tmp = octave::feval (eigs_fcn, args, 1); |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
113 } |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
114 catch (octave::execution_exception& ee) |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
115 { |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
116 err_user_supplied_eval (ee, "eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
117 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
118 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
119 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
120 { |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
121 retval = tmp(0).xcomplex_vector_value ("eigs: evaluation of user-supplied function failed"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
122 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
123 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
124 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
125 eigs_error = 1; |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
20956
diff
changeset
|
126 err_user_supplied_eval ("eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
127 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
128 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
129 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
130 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
131 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
132 |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
133 #endif |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
134 |
28024
c28b8ba841fb
move sparse functions from dldfcn to corefcn directory (bug #57459)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
135 DEFMETHOD (__eigs__, interp, args, nargout, |
c28b8ba841fb
move sparse functions from dldfcn to corefcn directory (bug #57459)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
136 doc: /* -*- texinfo -*- |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
137 @deftypefn {} {@var{d} =} __eigs__ (@var{A}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
138 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
139 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
140 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma}, @var{opts}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
141 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
142 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
143 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
144 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
145 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
146 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
147 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
148 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
149 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
150 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
151 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
152 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
153 @deftypefnx {} {[@var{V}, @var{d}] =} __eigs__ (@var{A}, @dots{}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
154 @deftypefnx {} {[@var{V}, @var{d}] =} __eigs__ (@var{af}, @var{n}, @dots{}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
155 @deftypefnx {} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{A}, @dots{}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
156 @deftypefnx {} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{af}, @var{n}, @dots{}) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
157 Undocumented internal function. |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21743
diff
changeset
|
158 @end deftypefn */) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
159 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
160 #if defined (HAVE_ARPACK) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
161 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
162 int nargin = args.length (); |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
163 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
164 if (nargin == 0) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
165 print_usage (); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
166 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
167 octave_value_list retval; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
168 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
169 std::string fcn_name; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
170 octave_idx_type n = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
171 octave_idx_type k = 6; |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
172 Complex sigma = 0.0; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
173 double sigmar, sigmai; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
174 bool have_sigma = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
175 std::string typ = "LM"; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
176 Matrix amm, bmm, bmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
177 ComplexMatrix acm, bcm, bct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
178 SparseMatrix asmm, bsmm, bsmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
179 SparseComplexMatrix ascm, bscm, bsct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
180 int b_arg = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
181 bool have_b = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
182 bool have_a_fun = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
183 bool a_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
184 bool b_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
185 bool symmetric = false; |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
186 bool sym_tested = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
187 bool cholB = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
188 bool a_is_sparse = false; |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
189 bool b_is_sparse = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
190 ColumnVector permB; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
191 int arg_offset = 0; |
15220
61822c866ba1
use std::numeric_limits<T>::epsilon in C++ code
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
192 double tol = std::numeric_limits<double>::epsilon (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
193 int maxit = 300; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
194 int disp = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
195 octave_idx_type p = -1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
196 ColumnVector resid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
197 ComplexColumnVector cresid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
198 octave_idx_type info = 1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
199 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
200 warned_imaginary = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
201 |
28817
aef839f40da2
Replace unwind_protect with more efficient constructs (bug #59192).
Rik <rik@octave.org>
parents:
28024
diff
changeset
|
202 octave::unwind_protect_var<int> restore_var (call_depth); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
203 call_depth++; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
204 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
205 if (call_depth > 1) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
206 error ("eigs: invalid recursive call"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
207 |
20790
c2d9556d51d0
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20785
diff
changeset
|
208 if (args(0).is_function_handle () || args(0).is_inline_function () |
c2d9556d51d0
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20785
diff
changeset
|
209 || args(0).is_string ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
210 { |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
211 eigs_fcn = octave::get_function_handle (interp, args(0), "x"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
212 |
26864
041caa61ed34
use get_function_handle instead of extract_function
John W. Eaton <jwe@octave.org>
parents:
26495
diff
changeset
|
213 if (eigs_fcn.is_undefined ()) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
214 error ("eigs: unknown function"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
215 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
216 if (nargin < 2) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
217 error ("eigs: incorrect number of arguments"); |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
218 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
219 n = args(1).nint_value (); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
220 arg_offset = 1; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
221 have_a_fun = true; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
222 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
223 else |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
224 { |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23478
diff
changeset
|
225 if (args(0).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
226 { |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
227 if (args(0).issparse ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
228 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14844
diff
changeset
|
229 ascm = (args(0).sparse_complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
230 a_is_sparse = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
231 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
232 else |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14844
diff
changeset
|
233 acm = (args(0).complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
234 a_is_complex = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
235 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
236 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
237 { |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
238 if (args(0).issparse ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
239 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14844
diff
changeset
|
240 asmm = (args(0).sparse_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
241 a_is_sparse = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
242 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
243 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
244 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14844
diff
changeset
|
245 amm = (args(0).matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
246 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
247 } |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
248 } |
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
249 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
250 // Note hold off reading B until later to avoid issues of double |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
251 // copies of the matrix if B is full/real while A is complex. |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
252 if (nargin > 1 + arg_offset |
19864
17d647821d61
maint: More cleanup of C++ code to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
253 && ! (args(1 + arg_offset).is_real_scalar ())) |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
254 { |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23478
diff
changeset
|
255 if (args(1+arg_offset).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
256 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
257 b_arg = 1+arg_offset; |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
258 if (args(b_arg).issparse ()) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
259 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
260 bscm = (args(b_arg).sparse_complex_matrix_value ()); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
261 b_is_sparse = true; |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
262 } |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
263 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
264 bcm = (args(b_arg).complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
265 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
266 b_is_complex = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
267 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
268 } |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
269 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
270 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
271 b_arg = 1+arg_offset; |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
272 if (args(b_arg).issparse ()) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
273 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
274 bsmm = (args(b_arg).sparse_matrix_value ()); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
275 b_is_sparse = true; |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
276 } |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
277 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
278 bmm = (args(b_arg).matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
279 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
280 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
281 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
282 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
283 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
284 if (nargin > (1+arg_offset)) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
285 k = args(1+arg_offset).nint_value (); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
286 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
287 if (nargin > (2+arg_offset)) |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
288 { |
8845
5a6db6bd1a02
eigs.cc (Feigs): fix handling of sigma arg
John W. Eaton <jwe@octave.org>
parents:
8702
diff
changeset
|
289 if (args(2+arg_offset).is_string ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
290 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
291 typ = args(2+arg_offset).string_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
292 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
293 // Use STL function to convert to upper case |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
294 transform (typ.begin (), typ.end (), typ.begin (), toupper); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
295 |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
296 sigma = 0.0; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
297 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
298 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
299 { |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
300 sigma = args(2+arg_offset).xcomplex_value ("eigs: SIGMA must be a scalar or a string"); |
8845
5a6db6bd1a02
eigs.cc (Feigs): fix handling of sigma arg
John W. Eaton <jwe@octave.org>
parents:
8702
diff
changeset
|
301 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
302 have_sigma = true; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
303 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
304 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
305 |
22274
edcad35c364f
don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
306 sigmar = sigma.real (); |
edcad35c364f
don't rely on std:: overloads of arg, conj, imag, and real for real args
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
307 sigmai = sigma.imag (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
308 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
309 if (nargin > (3+arg_offset)) |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
310 { |
23584
7ed6b258db91
maint: Deprecate is_map and replace with isstruct.
Rik <rik@octave.org>
parents:
23583
diff
changeset
|
311 if (! args(3+arg_offset).isstruct ()) |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
312 error ("eigs: OPTS argument must be a structure"); |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
313 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
314 octave_scalar_map map = args(3+arg_offset).xscalar_map_value ("eigs: OPTS argument must be a scalar structure"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
315 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
316 octave_value tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
317 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
318 // issym is ignored for complex matrix inputs |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
319 tmp = map.getfield ("issym"); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
320 if (tmp.is_defined ()) |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
321 { |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
322 if (tmp.numel () != 1) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
323 error ("eigs: OPTS.issym must be a scalar value"); |
26495
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
324 |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
325 symmetric = tmp.xbool_value ("eigs: OPTS.issym must be a logical value"); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
326 sym_tested = true; |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
327 } |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
328 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
329 // isreal is ignored if A is not a function |
26495
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
330 if (have_a_fun) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
331 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
332 tmp = map.getfield ("isreal"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
333 if (tmp.is_defined ()) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
334 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
335 if (tmp.numel () != 1) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
336 error ("eigs: OPTS.isreal must be a scalar value"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
337 |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
338 a_is_complex = ! tmp.xbool_value ("eigs: OPTS.isreal must be a logical value"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
339 } |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
340 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
341 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
342 tmp = map.getfield ("tol"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
343 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
344 tol = tmp.double_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
345 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
346 tmp = map.getfield ("maxit"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
347 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
348 maxit = tmp.nint_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
349 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
350 tmp = map.getfield ("p"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
351 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
352 p = tmp.nint_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
353 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
354 tmp = map.getfield ("v0"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
355 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
356 { |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
357 if (a_is_complex || b_is_complex) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
358 cresid = ComplexColumnVector (tmp.complex_vector_value ()); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
359 else |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
360 resid = ColumnVector (tmp.vector_value ()); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
361 } |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
362 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
363 tmp = map.getfield ("disp"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
364 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
365 disp = tmp.nint_value (); |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
366 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
367 tmp = map.getfield ("cholB"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
368 if (tmp.is_defined ()) |
26495
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
369 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
370 if (tmp.numel () != 1) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
371 error ("eigs: OPTS.cholB must be a scalar value"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
372 |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
373 cholB = tmp.xbool_value ("eigs: OPTS.cholB must be a logical value"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
374 } |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
375 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
376 tmp = map.getfield ("permB"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
377 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
378 permB = ColumnVector (tmp.vector_value ()) - 1.0; |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
379 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
380 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
381 if (nargin > (4+arg_offset)) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
382 error ("eigs: incorrect number of arguments"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
383 |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
384 // Test undeclared (no issym) matrix inputs for symmetry |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20939
diff
changeset
|
385 if (! sym_tested && ! have_a_fun) |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
386 { |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
387 if (a_is_complex) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
388 { |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
389 if (a_is_sparse) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
390 symmetric = ascm.ishermitian (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
391 else |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
392 symmetric = acm.ishermitian (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
393 } |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
394 else |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
395 { |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
396 if (a_is_sparse) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
397 symmetric = asmm.issymmetric (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
398 else |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
399 symmetric = amm.issymmetric (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
400 } |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
401 } |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
402 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
403 if (have_b) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
404 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
405 if (a_is_complex || b_is_complex) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
406 { |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
407 if (b_is_sparse) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
408 bscm = args(b_arg).sparse_complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
409 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
410 bcm = args(b_arg).complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
411 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
412 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
413 { |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
414 if (b_is_sparse) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
415 bsmm = args(b_arg).sparse_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
416 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
417 bmm = args(b_arg).matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
418 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
419 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
420 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
421 // Mode 1 for SM mode seems unstable for some reason. |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
422 // Use Mode 3 instead, with sigma = 0. |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
423 if (! have_sigma && typ == "SM") |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
424 have_sigma = true; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
425 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
426 octave_idx_type nconv; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
427 if (a_is_complex || b_is_complex) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
428 { |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
429 ComplexMatrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
430 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
431 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
432 if (have_a_fun) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
433 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
434 if (b_is_sparse) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
435 nconv = EigsComplexNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
436 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
437 eig_val, bscm, permB, cresid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
438 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
439 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
440 nconv = EigsComplexNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
441 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
442 eig_val, bcm, permB, cresid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
443 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
444 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
445 else if (have_sigma) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
446 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
447 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
448 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
449 (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
450 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
451 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
452 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
453 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
454 (acm, sigma, k, p, info, eig_vec, eig_val, bcm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
455 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
456 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
457 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
458 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
459 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
460 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
461 nconv = EigsComplexNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
462 (ascm, typ, k, p, info, eig_vec, eig_val, bscm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
463 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
464 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
465 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
466 nconv = EigsComplexNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
467 (acm, typ, k, p, info, eig_vec, eig_val, bcm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
468 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
469 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
470 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
471 |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
472 if (nargout < 2) |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
473 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
474 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
475 retval(0) = real (eig_val); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
476 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
477 retval(0) = eig_val; |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
478 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
479 else |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
480 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
481 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
482 retval = ovl (eig_vec, DiagMatrix (real (eig_val)), double (info)); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
483 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
484 retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info)); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
485 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
486 } |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
487 else if (sigmai != 0.0) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
488 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
489 // Promote real problem to a complex one. |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
490 ComplexMatrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
491 ComplexColumnVector eig_val; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
492 |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
493 if (have_a_fun) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
494 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
495 if (b_is_sparse) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
496 nconv = EigsComplexNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
497 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
498 eig_val, bscm, permB, cresid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
499 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
500 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
501 nconv = EigsComplexNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
502 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
503 eig_val, bcm, permB, cresid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
504 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
505 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
506 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
507 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
508 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
509 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
510 (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
511 eig_val, SparseComplexMatrix (bsmm), permB, cresid, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
512 octave_stdout, tol, (nargout > 1), cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
513 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
514 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
515 (ComplexMatrix (amm), sigma, k, p, info, eig_vec, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
516 eig_val, ComplexMatrix (bmm), permB, cresid, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
517 octave_stdout, tol, (nargout > 1), cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
518 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
519 |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
520 if (nargout < 2) |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
521 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
522 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
523 retval(0) = real (eig_val); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
524 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
525 retval(0) = eig_val; |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
526 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
527 else |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
528 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
529 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
530 retval = ovl (eig_vec, DiagMatrix (real (eig_val)), double (info)); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
531 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
532 retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info)); |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
533 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
534 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
535 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
536 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
537 if (symmetric) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
538 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
539 Matrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
540 ColumnVector eig_val; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
541 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
542 if (have_a_fun) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
543 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
544 if (b_is_sparse) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
545 nconv = EigsRealSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
546 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
547 eig_val, bsmm, permB, resid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
548 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
549 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
550 nconv = EigsRealSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
551 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
552 eig_val, bmm, permB, resid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
553 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
554 } |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
555 else if (have_sigma) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
556 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
557 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
558 nconv = EigsRealSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
559 (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
560 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
561 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
562 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
563 nconv = EigsRealSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
564 (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
565 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
566 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
567 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
568 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
569 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
570 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
571 nconv = EigsRealSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
572 (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
573 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
574 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
575 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
576 nconv = EigsRealSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
577 (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
578 resid, octave_stdout, tol, (nargout > 1), cholB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
579 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
580 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
581 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
582 if (nargout < 2) |
14844
5bc9b9cb4362
maint: Use Octave coding conventions for cuddled parenthesis in retval assignments.
Rik <octave@nomad.inbox5.com>
parents:
14501
diff
changeset
|
583 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
584 else |
20871
1e4edab2d22f
2015 Code Sprint: __eigs__.cc: use ovl ().
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
585 retval = ovl (eig_vec, DiagMatrix (eig_val), double (info)); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
586 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
587 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
588 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
589 ComplexMatrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
590 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
591 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
592 if (have_a_fun) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
593 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
594 if (b_is_sparse) |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
595 nconv = EigsRealNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
596 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
597 eig_val, bsmm, permB, resid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
598 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
599 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
600 nconv = EigsRealNonSymmetricFunc |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
601 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
602 eig_val, bmm, permB, resid, octave_stdout, tol, |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
603 (nargout > 1), cholB, disp, maxit); |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
604 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
605 else if (have_sigma) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
606 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
607 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
608 nconv = EigsRealNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
609 (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
610 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
611 cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
612 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
613 nconv = EigsRealNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
614 (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
615 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
616 cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
617 } |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
618 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
619 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
620 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
621 nconv = EigsRealNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
622 (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
623 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
624 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
625 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
626 nconv = EigsRealNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
627 (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
628 resid, octave_stdout, tol, (nargout > 1), cholB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
629 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
630 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
631 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
632 if (nargout < 2) |
14844
5bc9b9cb4362
maint: Use Octave coding conventions for cuddled parenthesis in retval assignments.
Rik <octave@nomad.inbox5.com>
parents:
14501
diff
changeset
|
633 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
634 else |
20871
1e4edab2d22f
2015 Code Sprint: __eigs__.cc: use ovl ().
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
635 retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info)); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
636 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
637 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
638 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
639 if (nconv <= 0) |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
640 warning_with_id ("Octave:eigs:UnconvergedEigenvalues", |
26164
7f6a50f73625
Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25696
diff
changeset
|
641 "eigs: None of the %" OCTAVE_IDX_TYPE_FORMAT |
7f6a50f73625
Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25696
diff
changeset
|
642 " requested eigenvalues converged", k); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
643 else if (nconv < k) |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
644 warning_with_id ("Octave:eigs:UnconvergedEigenvalues", |
26164
7f6a50f73625
Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25696
diff
changeset
|
645 "eigs: Only %" OCTAVE_IDX_TYPE_FORMAT |
7f6a50f73625
Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25696
diff
changeset
|
646 " of the %" OCTAVE_IDX_TYPE_FORMAT |
7f6a50f73625
Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25696
diff
changeset
|
647 " requested eigenvalues converged", |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
648 nconv, k); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
649 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
650 if (! fcn_name.empty ()) |
23699
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
651 { |
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
652 octave::symbol_table& symtab = interp.get_symbol_table (); |
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
653 |
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
654 symtab.clear_function (fcn_name); |
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
655 } |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
656 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
657 return retval; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
658 |
14144
834df9f10963
remove ARPACK files from sources and restore configure checks for external ARPACK library
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
659 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
660 |
24119
3cdd0705745b
maint: silence compiler warning when building without ARPACK
Mike Miller <mtmiller@octave.org>
parents:
23699
diff
changeset
|
661 octave_unused_parameter (interp); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
662 octave_unused_parameter (args); |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
663 octave_unused_parameter (nargout); |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
664 |
21109
bd1752782e56
Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
665 err_disabled_feature ("eigs", "ARPACK"); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
666 |
14144
834df9f10963
remove ARPACK files from sources and restore configure checks for external ARPACK library
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
667 #endif |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
668 } |
21575
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
669 |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
670 /* |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
671 ## No test needed for internal helper function. |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
672 %!assert (1) |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
673 */ |