Mercurial > octave
annotate libinterp/corefcn/__eigs__.cc @ 31605:e88a07dec498 stable
maint: Use macros to begin/end C++ namespaces.
* oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE,
OCTAVE_END_NAMESPACE) that can be used to start/end a namespace.
* mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc,
__dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc,
__ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc,
auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h,
call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc,
colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc,
defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc,
display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc,
ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h,
event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc,
fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc,
ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc,
getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc,
gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc,
graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc,
help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc,
ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h,
mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc,
oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h,
oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h,
oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h,
oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy,
ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc,
pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h,
sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc,
sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h,
stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc,
symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h,
symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h,
text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc,
toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc,
url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc,
variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh,
mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc,
ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h,
ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc,
ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h,
ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc,
op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc,
op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc,
op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc,
op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc,
op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc,
op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc,
op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc,
op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc,
op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc,
op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc,
op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc,
op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc,
op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc,
op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc,
op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc,
op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc,
op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc,
oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h,
pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h,
pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h,
pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h,
pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h,
pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc,
pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc,
pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc,
pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc,
pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc,
pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc,
pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h,
pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h,
range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc,
chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h,
lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h,
oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h,
oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc,
qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc,
randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc,
sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc,
child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc,
file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h,
mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h,
oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc,
oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h,
base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h,
file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc,
lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h,
oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h,
oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h,
oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h,
pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h,
url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 14:23:45 -0800 |
parents | c9788d7f6e65 |
children | aac27ad79be6 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30390
diff
changeset
|
3 // Copyright (C) 2005-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
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 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30896
diff
changeset
|
48 OCTAVE_BEGIN_NAMESPACE(octave) |
29998
8d86806fcdfd
* __eigs.cc__: Move all functions inside octave namespace.
John W. Eaton <jwe@octave.org>
parents:
29961
diff
changeset
|
49 |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
50 #if defined (HAVE_ARPACK) |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
51 |
30155
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
52 struct eigs_callback |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
53 { |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
54 public: |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
56 ColumnVector |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
57 eigs_func (const ColumnVector& x, int& eigs_error); |
29998
8d86806fcdfd
* __eigs.cc__: Move all functions inside octave namespace.
John W. Eaton <jwe@octave.org>
parents:
29961
diff
changeset
|
58 |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
59 ComplexColumnVector |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
60 eigs_complex_func (const ComplexColumnVector& x, int& eigs_error); |
30155
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
61 |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
62 //-------- |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
63 |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
64 // Pointer for user defined function. |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
65 octave_value m_eigs_fcn; |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
66 |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
67 // Have we warned about imaginary values returned from user function? |
14b098a6ba46
maint: Use public: qualifier in structs that are really classes.
Rik <rik@octave.org>
parents:
30044
diff
changeset
|
68 bool m_warned_imaginary = false; |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
69 }; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
70 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
71 // Is this a recursive call? |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
72 static int call_depth = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
73 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
74 ColumnVector |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
75 eigs_callback::eigs_func (const ColumnVector& x, int& eigs_error) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
76 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
77 ColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
78 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
79 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
80 |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
81 if (m_eigs_fcn.is_defined ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
82 { |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
83 octave_value_list tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
84 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
85 try |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
86 { |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
87 tmp = octave::feval (m_eigs_fcn, args, 1); |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
88 } |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
89 catch (octave::execution_exception& ee) |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
90 { |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
91 err_user_supplied_eval (ee, "eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
92 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
93 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
94 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
95 { |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
96 if (! m_warned_imaginary && tmp(0).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
97 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
98 warning ("eigs: ignoring imaginary part returned from user-supplied function"); |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
99 m_warned_imaginary = true; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
100 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
101 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
102 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
|
103 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
104 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
105 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
106 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
|
107 err_user_supplied_eval ("eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
108 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
109 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
110 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
111 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
112 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
113 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
114 ComplexColumnVector |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
115 eigs_callback::eigs_complex_func (const ComplexColumnVector& x, |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
116 int& eigs_error) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
117 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
118 ComplexColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
119 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
120 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
121 |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
122 if (m_eigs_fcn.is_defined ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
123 { |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
124 octave_value_list tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
125 |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
126 try |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
127 { |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
128 tmp = octave::feval (m_eigs_fcn, args, 1); |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
129 } |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
130 catch (octave::execution_exception& ee) |
20743
b6408331bfa2
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20703
diff
changeset
|
131 { |
29163
8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents:
28817
diff
changeset
|
132 err_user_supplied_eval (ee, "eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
133 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
134 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
135 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
136 { |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
137 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
|
138 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
139 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
140 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
141 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
|
142 err_user_supplied_eval ("eigs"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
143 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
144 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
145 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
146 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
147 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
148 |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
149 #endif |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
150 |
28024
c28b8ba841fb
move sparse functions from dldfcn to corefcn directory (bug #57459)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
151 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
|
152 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
|
153 @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
|
154 @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
|
155 @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
|
156 @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
|
157 @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
|
158 @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
|
159 @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
|
160 @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
|
161 @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
|
162 @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
|
163 @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
|
164 @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
|
165 @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
|
166 @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
|
167 @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
|
168 @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
|
169 @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
|
170 @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
|
171 @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
|
172 @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
|
173 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
|
174 @end deftypefn */) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
175 { |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21691
diff
changeset
|
176 #if defined (HAVE_ARPACK) |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
177 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
178 int nargin = args.length (); |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
179 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
180 if (nargin == 0) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
181 print_usage (); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
182 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
183 octave_value_list retval; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
184 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
185 std::string fcn_name; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
186 octave_idx_type n = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
187 octave_idx_type k = 6; |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
188 Complex sigma = 0.0; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
189 double sigmar, sigmai; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
190 bool have_sigma = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
191 std::string typ = "LM"; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
192 Matrix amm, bmm, bmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
193 ComplexMatrix acm, bcm, bct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
194 SparseMatrix asmm, bsmm, bsmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
195 SparseComplexMatrix ascm, bscm, bsct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
196 int b_arg = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
197 bool have_b = false; |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
198 bool have_a_fcn = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
199 bool a_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
200 bool b_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
201 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
|
202 bool sym_tested = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
203 bool cholB = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
204 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
|
205 bool b_is_sparse = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
206 ColumnVector permB; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
207 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
|
208 double tol = std::numeric_limits<double>::epsilon (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
209 int maxit = 300; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
210 int disp = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
211 octave_idx_type p = -1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
212 ColumnVector resid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
213 ComplexColumnVector cresid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
214 octave_idx_type info = 1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
215 |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
216 eigs_callback callback; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
217 |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
218 unwind_protect_var<int> restore_var (call_depth); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
219 call_depth++; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
220 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
221 if (call_depth > 1) |
20956
850e3d2533d4
maint: Eliminate more useless statements after error().
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
222 error ("eigs: invalid recursive call"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
223 |
20790
c2d9556d51d0
eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents:
20785
diff
changeset
|
224 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
|
225 || args(0).is_string ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
226 { |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
227 callback.m_eigs_fcn = get_function_handle (interp, args(0), "x"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
228 |
30044
1f34286a2637
maint: use "m_" prefix for member variables of classes associated with EIG.
Rik <rik@octave.org>
parents:
29998
diff
changeset
|
229 if (callback.m_eigs_fcn.is_undefined ()) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
230 error ("eigs: unknown function"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
231 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
232 if (nargin < 2) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
233 error ("eigs: incorrect number of arguments"); |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
234 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
235 n = args(1).nint_value (); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
236 arg_offset = 1; |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
237 have_a_fcn = true; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
238 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
239 else |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
240 { |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23478
diff
changeset
|
241 if (args(0).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
242 { |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
243 if (args(0).issparse ()) |
10154
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 ascm = (args(0).sparse_complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
246 a_is_sparse = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
247 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
248 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
|
249 acm = (args(0).complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
250 a_is_complex = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
251 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
252 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
253 { |
23583
b7747a2c88b2
maint: Deprecate is_sparse_type and replace with issparse.
Rik <rik@octave.org>
parents:
23581
diff
changeset
|
254 if (args(0).issparse ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
255 { |
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
|
256 asmm = (args(0).sparse_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
257 a_is_sparse = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
258 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
259 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
260 { |
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
|
261 amm = (args(0).matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
262 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
263 } |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
264 } |
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
265 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
266 // 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
|
267 // 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
|
268 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
|
269 && ! (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
|
270 { |
23581
c3075ae020e1
maint: Deprecate is_complex_type and replace with iscomplex.
Rik <rik@octave.org>
parents:
23478
diff
changeset
|
271 if (args(1+arg_offset).iscomplex ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
272 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
273 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
|
274 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
|
275 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
276 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
|
277 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
|
278 } |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
279 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
280 bcm = (args(b_arg).complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
281 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
282 b_is_complex = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
283 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
284 } |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
285 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
286 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
287 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
|
288 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
|
289 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
290 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
|
291 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
|
292 } |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
293 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
294 bmm = (args(b_arg).matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
295 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
296 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
297 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
298 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
299 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
300 if (nargin > (1+arg_offset)) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
301 k = args(1+arg_offset).nint_value (); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
302 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
303 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
|
304 { |
8845
5a6db6bd1a02
eigs.cc (Feigs): fix handling of sigma arg
John W. Eaton <jwe@octave.org>
parents:
8702
diff
changeset
|
305 if (args(2+arg_offset).is_string ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
306 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
307 typ = args(2+arg_offset).string_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
308 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
309 // Use STL function to convert to upper case |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
310 transform (typ.begin (), typ.end (), typ.begin (), toupper); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
311 |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
312 sigma = 0.0; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
313 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
314 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
315 { |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
316 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
|
317 |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
318 have_sigma = true; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
319 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
320 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
321 |
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
|
322 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
|
323 sigmai = sigma.imag (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
324 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
325 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
|
326 { |
23584
7ed6b258db91
maint: Deprecate is_map and replace with isstruct.
Rik <rik@octave.org>
parents:
23583
diff
changeset
|
327 if (! args(3+arg_offset).isstruct ()) |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
328 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
|
329 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
330 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
|
331 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
332 octave_value tmp; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
333 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
334 // 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
|
335 tmp = map.getfield ("issym"); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
336 if (tmp.is_defined ()) |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
337 { |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
338 if (tmp.numel () != 1) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
339 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
|
340 |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
341 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
|
342 sym_tested = true; |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
343 } |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
344 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
345 // isreal is ignored if A is not a function |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
346 if (have_a_fcn) |
26495
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
347 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
348 tmp = map.getfield ("isreal"); |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
349 if (tmp.is_defined ()) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
350 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
351 if (tmp.numel () != 1) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
352 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
|
353 |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
354 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
|
355 } |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
356 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
357 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
358 tmp = map.getfield ("tol"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
359 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
360 tol = tmp.double_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
361 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
362 tmp = map.getfield ("maxit"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
363 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
364 maxit = tmp.nint_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
365 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
366 tmp = map.getfield ("p"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
367 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
368 p = tmp.nint_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
369 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
370 tmp = map.getfield ("v0"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
371 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
372 { |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
373 if (a_is_complex || b_is_complex) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
374 cresid = ComplexColumnVector (tmp.complex_vector_value ()); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
375 else |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
376 resid = ColumnVector (tmp.vector_value ()); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
377 } |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
378 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
379 tmp = map.getfield ("disp"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
380 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
381 disp = tmp.nint_value (); |
20703
85e5efae848a
eliminate more uses of error_state
John W. Eaton <jwe@octave.org>
parents:
20687
diff
changeset
|
382 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
383 tmp = map.getfield ("cholB"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
384 if (tmp.is_defined ()) |
26495
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
385 { |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
386 if (tmp.numel () != 1) |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
387 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
|
388 |
f0065630ad9d
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
389 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
|
390 } |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
391 |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
392 tmp = map.getfield ("permB"); |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
393 if (tmp.is_defined ()) |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
394 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
|
395 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
396 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
397 if (nargin > (4+arg_offset)) |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
398 error ("eigs: incorrect number of arguments"); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
399 |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
400 // Test undeclared (no issym) matrix inputs for symmetry |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
401 if (! sym_tested && ! have_a_fcn) |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
402 { |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
403 if (a_is_complex) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
404 { |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
405 if (a_is_sparse) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
406 symmetric = ascm.ishermitian (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
407 else |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
408 symmetric = acm.ishermitian (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
409 } |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
410 else |
27692
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
411 { |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
412 if (a_is_sparse) |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
413 symmetric = asmm.issymmetric (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
414 else |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
415 symmetric = amm.issymmetric (); |
e557774a2604
Return real values for Hermitian inputs to eigs (bug #57196).
Rik <rik@octave.org>
parents:
27683
diff
changeset
|
416 } |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
417 } |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
418 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
419 if (have_b) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
420 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
421 if (a_is_complex || b_is_complex) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
422 { |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
423 if (b_is_sparse) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
424 bscm = args(b_arg).sparse_complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
425 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
426 bcm = args(b_arg).complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
427 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
428 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
429 { |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
430 if (b_is_sparse) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
431 bsmm = args(b_arg).sparse_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
432 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
433 bmm = args(b_arg).matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
434 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
435 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
436 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
437 // 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
|
438 // 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
|
439 if (! have_sigma && typ == "SM") |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
440 have_sigma = true; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
441 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
442 octave_idx_type nconv; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
443 if (a_is_complex || b_is_complex) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
444 { |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
445 EigsComplexFunc |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
446 eigs_complex_fcn = [&callback] (const ComplexColumnVector& x, |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
447 int& eigs_error) |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
448 { |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
449 return callback.eigs_complex_func (x, eigs_error); |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
450 }; |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
451 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
452 ComplexMatrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
453 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
454 |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
455 if (have_a_fcn) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
456 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
457 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
|
458 nconv = EigsComplexNonSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
459 (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
460 eig_val, bscm, permB, cresid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
461 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
462 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
463 nconv = EigsComplexNonSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
464 (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
465 eig_val, bcm, permB, cresid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
466 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
467 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
468 else if (have_sigma) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
469 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
470 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
471 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
472 (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
|
473 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
474 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
475 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
476 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
477 (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
|
478 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
479 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
480 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
481 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
482 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
483 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
484 nconv = EigsComplexNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
485 (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
|
486 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
487 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
488 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
489 nconv = EigsComplexNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
490 (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
|
491 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
492 maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
493 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
494 |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
495 if (nargout < 2) |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
496 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
497 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
498 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
|
499 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
500 retval(0) = eig_val; |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
501 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
502 else |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
503 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
504 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
505 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
|
506 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
507 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
|
508 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
509 } |
26344
acfd683ea00b
__eigs__.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26164
diff
changeset
|
510 else if (sigmai != 0.0) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
511 { |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
512 EigsComplexFunc |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
513 eigs_complex_fcn = [&callback] (const ComplexColumnVector& x, |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
514 int& eigs_error) |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
515 { |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
516 return callback.eigs_complex_func (x, eigs_error); |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
517 }; |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
518 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
519 // 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
|
520 ComplexMatrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
521 ComplexColumnVector eig_val; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
522 |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
523 if (have_a_fcn) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
524 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
525 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
|
526 nconv = EigsComplexNonSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
527 (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
528 eig_val, bscm, permB, cresid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
529 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
530 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
531 nconv = EigsComplexNonSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
532 (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
533 eig_val, bcm, permB, cresid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
534 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
535 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
536 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
537 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
538 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
539 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
540 (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
541 eig_val, SparseComplexMatrix (bsmm), permB, cresid, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
542 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
|
543 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
544 nconv = EigsComplexNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
545 (ComplexMatrix (amm), sigma, k, p, info, eig_vec, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
546 eig_val, ComplexMatrix (bmm), permB, cresid, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
547 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
|
548 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
549 |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
550 if (nargout < 2) |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
551 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
552 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
553 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
|
554 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
555 retval(0) = eig_val; |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
556 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
557 else |
27683
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
558 { |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
559 if (symmetric) |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
560 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
|
561 else |
6604b41ca63f
Return only real eigenvalues from eigs() for symmetric matrices (bug #57196).
Rik <rik@octave.org>
parents:
26864
diff
changeset
|
562 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
|
563 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
564 } |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
565 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
566 { |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
567 EigsFunc eigs_fcn = [&callback] (const ColumnVector& x, int& eigs_error) |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
568 { |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
569 return callback.eigs_func (x, eigs_error); |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
570 }; |
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
571 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
572 if (symmetric) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
573 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
574 Matrix eig_vec; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
575 ColumnVector eig_val; |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
576 |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
577 if (have_a_fcn) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
578 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
579 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
|
580 nconv = EigsRealSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
581 (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
582 eig_val, bsmm, permB, resid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
583 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
584 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
585 nconv = EigsRealSymmetricFunc |
30390
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
586 (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
587 eig_val, bmm, permB, resid, octave_stdout, tol, |
a61e1a0f6024
maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30155
diff
changeset
|
588 (nargout > 1), cholB, disp, maxit); |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
589 } |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
590 else if (have_sigma) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
591 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
592 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
593 nconv = EigsRealSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
594 (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
|
595 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
596 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
597 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
598 nconv = EigsRealSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
599 (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
|
600 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
601 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
602 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
603 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
604 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
605 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
606 nconv = EigsRealSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
607 (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
|
608 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
609 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
610 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
611 nconv = EigsRealSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
612 (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
|
613 resid, octave_stdout, tol, (nargout > 1), cholB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
614 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
615 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
616 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
617 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
|
618 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
619 else |
20871
1e4edab2d22f
2015 Code Sprint: __eigs__.cc: use ovl ().
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
620 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
|
621 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
622 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
623 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
624 ComplexMatrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
625 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
626 |
30896
c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
627 if (have_a_fcn) |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
628 { |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
629 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
|
630 nconv = EigsRealNonSymmetricFunc |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
631 (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec, |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
632 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
|
633 (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
|
634 else |
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
635 nconv = EigsRealNonSymmetricFunc |
29481
7b160bf6b897
eigs: Remove static variables (bug #60311).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29480
diff
changeset
|
636 (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec, |
25696
3b6691ff0f59
Fix eigs for generalized problems with user defined function (bug #54167).
Marco Caliari <marco.caliari@univr.it>
parents:
25054
diff
changeset
|
637 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
|
638 (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
|
639 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
640 else if (have_sigma) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
641 { |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
642 if (a_is_sparse) |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
643 nconv = EigsRealNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
644 (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
|
645 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
646 cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
647 else |
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
648 nconv = EigsRealNonSymmetricMatrixShift |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
649 (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
|
650 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
651 cholB, disp, maxit); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
652 } |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
653 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
654 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
655 if (a_is_sparse) |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
656 nconv = EigsRealNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
657 (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
|
658 permB, resid, octave_stdout, tol, (nargout > 1), |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
659 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
660 else |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
661 nconv = EigsRealNonSymmetricMatrix |
22407
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
662 (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
|
663 resid, octave_stdout, tol, (nargout > 1), cholB, |
34ce5be04942
maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents:
22327
diff
changeset
|
664 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
665 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
666 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
667 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
|
668 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
669 else |
20871
1e4edab2d22f
2015 Code Sprint: __eigs__.cc: use ovl ().
Rik <rik@octave.org>
parents:
20853
diff
changeset
|
670 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
|
671 } |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
672 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
673 |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
674 if (nconv <= 0) |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
675 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
|
676 "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
|
677 " requested eigenvalues converged", k); |
20556
4bed806ee3d4
eliminate more simple uses of error_state
John W. Eaton <jwe@octave.org>
parents:
19864
diff
changeset
|
678 else if (nconv < k) |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
679 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
|
680 "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
|
681 " 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
|
682 " requested eigenvalues converged", |
24334
d3d38a443df8
Add new warning ID "Octave:eigs:UnconvergedEigenvalues".
Rik <rik@octave.org>
parents:
24119
diff
changeset
|
683 nconv, k); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
684 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
685 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
|
686 { |
29961
7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
687 symbol_table& symtab = interp.get_symbol_table (); |
23699
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
688 |
b29904962d2d
deprecate some global functions that access the symbol table
John W. Eaton <jwe@octave.org>
parents:
23596
diff
changeset
|
689 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
|
690 } |
20825
66cd994d1b79
eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents:
20790
diff
changeset
|
691 |
20939
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
692 return retval; |
b17fda023ca6
maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents:
20871
diff
changeset
|
693 |
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
|
694 #else |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
695 |
24119
3cdd0705745b
maint: silence compiler warning when building without ARPACK
Mike Miller <mtmiller@octave.org>
parents:
23699
diff
changeset
|
696 octave_unused_parameter (interp); |
21691
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
697 octave_unused_parameter (args); |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
698 octave_unused_parameter (nargout); |
263d18409fdf
Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents:
21575
diff
changeset
|
699 |
21109
bd1752782e56
Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents:
21100
diff
changeset
|
700 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
|
701 |
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
|
702 #endif |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
703 } |
21575
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
704 |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
705 /* |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
706 ## 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
|
707 %!assert (1) |
bc9aa534bc29
maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
708 */ |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29481
diff
changeset
|
709 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
30896
diff
changeset
|
710 OCTAVE_END_NAMESPACE(octave) |