Mercurial > octave-nkf
annotate libinterp/dldfcn/__eigs__.cc @ 19627:446c46af4b42 stable
strip trailing whitespace from most source files
* Makefile.am, NEWS, build-aux/common.mk, configure.ac,
doc/Makefile.am, doc/doxyhtml/Makefile.am,
doc/interpreter/Makefile.am, doc/interpreter/arith.txi,
doc/interpreter/audio.txi, doc/interpreter/basics.txi,
doc/interpreter/bugs.txi, doc/interpreter/container.txi,
doc/interpreter/cp-idx.txi, doc/interpreter/data.txi,
doc/interpreter/debug.txi, doc/interpreter/diagperm.txi,
doc/interpreter/diffeq.txi, doc/interpreter/doccheck/README,
doc/interpreter/doccheck/spellcheck, doc/interpreter/emacs.txi,
doc/interpreter/errors.txi, doc/interpreter/eval.txi,
doc/interpreter/expr.txi, doc/interpreter/external.txi,
doc/interpreter/fn-idx.txi, doc/interpreter/func.txi,
doc/interpreter/geometry.txi, doc/interpreter/geometryimages.m,
doc/interpreter/gpl.txi, doc/interpreter/grammar.txi,
doc/interpreter/gui.txi, doc/interpreter/image.txi,
doc/interpreter/install.txi, doc/interpreter/interp.txi,
doc/interpreter/interpimages.m, doc/interpreter/intro.txi,
doc/interpreter/io.txi, doc/interpreter/java.txi,
doc/interpreter/linalg.txi, doc/interpreter/macros.texi,
doc/interpreter/matrix.txi, doc/interpreter/munge-texi.pl,
doc/interpreter/nonlin.txi, doc/interpreter/numbers.txi,
doc/interpreter/obsolete.txi, doc/interpreter/octave-config.1,
doc/interpreter/octave.texi, doc/interpreter/oop.txi,
doc/interpreter/op-idx.txi, doc/interpreter/optim.txi,
doc/interpreter/package.txi, doc/interpreter/plot.txi,
doc/interpreter/poly.txi, doc/interpreter/preface.txi,
doc/interpreter/quad.txi, doc/interpreter/set.txi,
doc/interpreter/signal.txi, doc/interpreter/sparse.txi,
doc/interpreter/sparseimages.m, doc/interpreter/splineimages.m,
doc/interpreter/stats.txi, doc/interpreter/stmt.txi,
doc/interpreter/strings.txi, doc/interpreter/system.txi,
doc/interpreter/testfun.txi, doc/interpreter/tips.txi,
doc/interpreter/var.txi, doc/interpreter/vectorize.txi,
doc/liboctave/Makefile.am, doc/liboctave/array.texi,
doc/liboctave/bugs.texi, doc/liboctave/cp-idx.texi,
doc/liboctave/dae.texi, doc/liboctave/diffeq.texi,
doc/liboctave/error.texi, doc/liboctave/factor.texi,
doc/liboctave/fn-idx.texi, doc/liboctave/gpl.texi,
doc/liboctave/install.texi, doc/liboctave/intro.texi,
doc/liboctave/liboctave.texi, doc/liboctave/matvec.texi,
doc/liboctave/nleqn.texi, doc/liboctave/nlfunc.texi,
doc/liboctave/ode.texi, doc/liboctave/optim.texi,
doc/liboctave/preface.texi, doc/liboctave/quad.texi,
doc/liboctave/range.texi, doc/refcard/Makefile.am,
doc/refcard/refcard.tex, etc/HACKING, etc/NEWS.1, etc/NEWS.2,
etc/NEWS.3, etc/OLD-ChangeLogs/ChangeLog,
etc/OLD-ChangeLogs/doc-ChangeLog,
etc/OLD-ChangeLogs/scripts-ChangeLog,
etc/OLD-ChangeLogs/src-ChangeLog, etc/OLD-ChangeLogs/test-ChangeLog,
etc/PROJECTS, etc/README.Cygwin, etc/README.MacOS, etc/README.MinGW,
etc/README.gnuplot, etc/gdbinit, etc/icons/Makefile.am,
examples/@polynomial/end.m, examples/@polynomial/subsasgn.m,
examples/Makefile.am, examples/standalonebuiltin.cc,
libgui/Makefile.am, libgui/qterminal/libqterminal/README,
libgui/qterminal/libqterminal/unix/BlockArray.cpp,
libgui/qterminal/libqterminal/unix/BlockArray.h,
libgui/qterminal/libqterminal/unix/Character.h,
libgui/qterminal/libqterminal/unix/CharacterColor.h,
libgui/qterminal/libqterminal/unix/Emulation.cpp,
libgui/qterminal/libqterminal/unix/Emulation.h,
libgui/qterminal/libqterminal/unix/Filter.cpp,
libgui/qterminal/libqterminal/unix/Filter.h,
libgui/qterminal/libqterminal/unix/History.cpp,
libgui/qterminal/libqterminal/unix/History.h,
libgui/qterminal/libqterminal/unix/KeyboardTranslator.cpp,
libgui/qterminal/libqterminal/unix/KeyboardTranslator.h,
libgui/qterminal/libqterminal/unix/LineFont.h,
libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp,
libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h,
libgui/qterminal/libqterminal/unix/Screen.cpp,
libgui/qterminal/libqterminal/unix/Screen.h,
libgui/qterminal/libqterminal/unix/ScreenWindow.cpp,
libgui/qterminal/libqterminal/unix/ScreenWindow.h,
libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.cpp,
libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.h,
libgui/qterminal/libqterminal/unix/Vt102Emulation.h,
libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp,
libgui/qterminal/qterminal/main.cpp,
libgui/src/m-editor/file-editor-tab.cc, libgui/src/octave-gui.cc,
libgui/src/octave-qt-link.cc, libinterp/corefcn/data.cc,
libinterp/corefcn/defun-int.h, libinterp/corefcn/det.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/graphics.cc,
libinterp/corefcn/graphics.in.h, libinterp/corefcn/ls-mat5.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/oct-tex-parser.yy,
libinterp/corefcn/oct-tex-symbols.in, libinterp/corefcn/quadcc.cc,
libinterp/corefcn/zfstream.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__voronoi__.cc, libinterp/gendoc.pl,
libinterp/genprops.awk, libinterp/mk-errno-list, libinterp/mk-pkg-add,
libinterp/mkbuiltins, libinterp/mkdefs, libinterp/mkdocs,
libinterp/mkops, libinterp/octave-value/ov-java.cc,
libinterp/parse-tree/lex.ll, libinterp/parse-tree/oct-parse.in.yy,
libinterp/parse-tree/octave.gperf, liboctave/Makefile.am,
liboctave/array/Array.cc, liboctave/array/module.mk,
liboctave/cruft/daspk/datv.f, liboctave/cruft/daspk/dcnst0.f,
liboctave/cruft/daspk/dcnstr.f, liboctave/cruft/daspk/ddasic.f,
liboctave/cruft/daspk/ddasid.f, liboctave/cruft/daspk/ddasik.f,
liboctave/cruft/daspk/ddaspk.f, liboctave/cruft/daspk/ddstp.f,
liboctave/cruft/daspk/ddwnrm.f, liboctave/cruft/daspk/dfnrmd.f,
liboctave/cruft/daspk/dfnrmk.f, liboctave/cruft/daspk/dhels.f,
liboctave/cruft/daspk/dheqr.f, liboctave/cruft/daspk/dinvwt.f,
liboctave/cruft/daspk/dlinsd.f, liboctave/cruft/daspk/dlinsk.f,
liboctave/cruft/daspk/dmatd.f, liboctave/cruft/daspk/dnedd.f,
liboctave/cruft/daspk/dnedk.f, liboctave/cruft/daspk/dnsd.f,
liboctave/cruft/daspk/dnsid.f, liboctave/cruft/daspk/dnsik.f,
liboctave/cruft/daspk/dnsk.f, liboctave/cruft/daspk/dorth.f,
liboctave/cruft/daspk/dslvd.f, liboctave/cruft/daspk/dslvk.f,
liboctave/cruft/daspk/dspigm.f, liboctave/cruft/daspk/dyypnw.f,
liboctave/cruft/dasrt/ddasrt.f, liboctave/cruft/dasrt/drchek.f,
liboctave/cruft/dassl/ddaslv.f, liboctave/cruft/dassl/ddassl.f,
liboctave/cruft/misc/blaswrap.c, liboctave/cruft/misc/module.mk,
liboctave/cruft/odepack/cfode.f, liboctave/cruft/odepack/dlsode.f,
liboctave/cruft/odepack/ewset.f, liboctave/cruft/odepack/intdy.f,
liboctave/cruft/odepack/prepj.f, liboctave/cruft/odepack/sintdy.f,
liboctave/cruft/odepack/slsode.f, liboctave/cruft/odepack/solsy.f,
liboctave/cruft/odepack/ssolsy.f, liboctave/cruft/odepack/stode.f,
liboctave/cruft/odepack/vnorm.f, liboctave/cruft/ranlib/Basegen.doc,
liboctave/cruft/ranlib/README, liboctave/cruft/ranlib/genbet.f,
liboctave/cruft/ranlib/genexp.f, liboctave/cruft/ranlib/gennch.f,
liboctave/cruft/ranlib/gennf.f, liboctave/cruft/ranlib/gennor.f,
liboctave/cruft/ranlib/getsd.f, liboctave/cruft/ranlib/initgn.f,
liboctave/cruft/ranlib/phrtsd.f, liboctave/cruft/ranlib/randlib.fdoc,
liboctave/cruft/ranlib/setsd.f, liboctave/cruft/ranlib/tstgmn.for,
liboctave/cruft/ranlib/tstmid.for, liboctave/cruft/slatec-fn/atanh.f,
liboctave/cruft/slatec-fn/datanh.f,
liboctave/cruft/slatec-fn/xgmainc.f,
liboctave/cruft/slatec-fn/xsgmainc.f, liboctave/numeric/module.mk,
liboctave/operators/mk-ops.awk, liboctave/operators/mx-ops,
liboctave/operators/sparse-mk-ops.awk,
liboctave/operators/sparse-mx-ops, liboctave/operators/vx-ops,
liboctave/util/module.mk, run-octave.in, scripts/@ftp/ftp.m,
scripts/audio/wavread.m, scripts/deprecated/java_convert_matrix.m,
scripts/deprecated/java_debug.m, scripts/deprecated/java_invoke.m,
scripts/deprecated/java_new.m,
scripts/deprecated/java_unsigned_conversion.m,
scripts/deprecated/javafields.m, scripts/deprecated/javamethods.m,
scripts/deprecated/shell_cmd.m, scripts/general/accumarray.m,
scripts/general/display.m, scripts/general/fieldnames.m,
scripts/general/interp1.m, scripts/general/interp2.m,
scripts/general/interp3.m, scripts/general/isa.m,
scripts/general/methods.m, scripts/general/sortrows.m,
scripts/geometry/convhull.m, scripts/geometry/delaunay.m,
scripts/geometry/delaunay3.m, scripts/geometry/delaunayn.m,
scripts/geometry/griddata.m, scripts/geometry/griddatan.m,
scripts/geometry/voronoi.m, scripts/geometry/voronoin.m,
scripts/gui/guihandles.m, scripts/gui/inputdlg.m,
scripts/gui/listdlg.m, scripts/gui/msgbox.m, scripts/gui/questdlg.m,
scripts/gui/uigetfile.m, scripts/gui/waitbar.m, scripts/gui/warndlg.m,
scripts/help/doc.m, scripts/help/help.m, scripts/help/type.m,
scripts/image/bone.m, scripts/image/cmpermute.m,
scripts/image/cmunique.m, scripts/image/colorcube.m,
scripts/image/colormap.m, scripts/image/contrast.m,
scripts/image/gray2ind.m, scripts/image/image.m,
scripts/image/imshow.m, scripts/image/ind2gray.m, scripts/image/jet.m,
scripts/image/rgb2ntsc.m, scripts/image/spinmap.m,
scripts/io/importdata.m, scripts/io/strread.m, scripts/io/textread.m,
scripts/io/textscan.m, scripts/java/java_get.m,
scripts/java/java_set.m, scripts/java/javaaddpath.m,
scripts/java/javaclasspath.m, scripts/java/javamem.m,
scripts/linear-algebra/linsolve.m, scripts/linear-algebra/qzhess.m,
scripts/miscellaneous/debug.m, scripts/miscellaneous/desktop.m,
scripts/miscellaneous/dir.m, scripts/miscellaneous/dos.m,
scripts/miscellaneous/edit.m, scripts/miscellaneous/fact.m,
scripts/miscellaneous/getappdata.m, scripts/miscellaneous/inputname.m,
scripts/miscellaneous/license.m, scripts/miscellaneous/ls_command.m,
scripts/miscellaneous/run.m, scripts/miscellaneous/setfield.m,
scripts/miscellaneous/unix.m, scripts/miscellaneous/ver.m,
scripts/mk-pkg-add, scripts/mkdoc.pl,
scripts/optimization/fminsearch.m, scripts/optimization/optimset.m,
scripts/optimization/sqp.m, scripts/pkg/pkg.m,
scripts/pkg/private/create_pkgadddel.m,
scripts/pkg/private/fix_depends.m, scripts/pkg/private/install.m,
scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m,
scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m,
scripts/plot/appearance/datetick.m, scripts/plot/appearance/grid.m,
scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m,
scripts/plot/appearance/shading.m, scripts/plot/appearance/text.m,
scripts/plot/appearance/title.m, scripts/plot/appearance/xlabel.m,
scripts/plot/appearance/ylabel.m, scripts/plot/appearance/zlabel.m,
scripts/plot/draw/area.m, scripts/plot/draw/bar.m,
scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m,
scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m,
scripts/plot/draw/contourf.m, scripts/plot/draw/ellipsoid.m,
scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m,
scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m,
scripts/plot/draw/ezpolar.m, scripts/plot/draw/fill.m,
scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m,
scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m,
scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m,
scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m,
scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m,
scripts/plot/draw/plotyy.m, scripts/plot/draw/private/__bar__.m,
scripts/plot/draw/private/__contour__.m,
scripts/plot/draw/private/__errplot__.m,
scripts/plot/draw/private/__ezplot__.m,
scripts/plot/draw/private/__patch__.m,
scripts/plot/draw/private/__stem__.m, scripts/plot/draw/rectangle.m,
scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m,
scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m,
scripts/plot/draw/semilogx.m, scripts/plot/draw/shrinkfaces.m,
scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m,
scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m,
scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m,
scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m,
scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m,
scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m,
scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m,
scripts/plot/util/__gnuplot_drawnow__.m,
scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/axes.m,
scripts/plot/util/clf.m, scripts/plot/util/copyobj.m,
scripts/plot/util/figure.m, scripts/plot/util/gcbo.m,
scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hggroup.m,
scripts/plot/util/meshgrid.m, scripts/plot/util/newplot.m,
scripts/plot/util/print.m,
scripts/plot/util/private/__add_default_menu__.m,
scripts/plot/util/private/__fltk_print__.m,
scripts/plot/util/private/__gnuplot_print__.m,
scripts/plot/util/private/__print_parse_opts__.m,
scripts/plot/util/refreshdata.m, scripts/plot/util/subplot.m,
scripts/polynomial/conv.m, scripts/polynomial/poly.m,
scripts/polynomial/polyeig.m, scripts/polynomial/polyfit.m,
scripts/polynomial/polyval.m,
scripts/polynomial/private/__splinefit__.m,
scripts/polynomial/spline.m, scripts/prefs/prefdir.m,
scripts/prefs/preferences.m, scripts/prefs/private/prefsfile.m,
scripts/prefs/rmpref.m, scripts/signal/freqz.m,
scripts/signal/module.mk, scripts/sparse/eigs.m, scripts/sparse/pcg.m,
scripts/sparse/private/__sprand_impl__.m, scripts/sparse/sprand.m,
scripts/sparse/sprandn.m, scripts/sparse/spy.m, scripts/sparse/svds.m,
scripts/specfun/expint.m, scripts/specfun/factor.m,
scripts/special-matrix/gallery.m, scripts/special-matrix/hankel.m,
scripts/special-matrix/toeplitz.m, scripts/startup/inputrc,
scripts/statistics/base/kurtosis.m, scripts/statistics/base/moment.m,
scripts/statistics/base/qqplot.m, scripts/statistics/base/var.m,
scripts/statistics/distributions/betarnd.m,
scripts/statistics/distributions/binoinv.m,
scripts/statistics/distributions/binopdf.m,
scripts/statistics/distributions/binornd.m,
scripts/statistics/distributions/cauchy_rnd.m,
scripts/statistics/distributions/chi2rnd.m,
scripts/statistics/distributions/discrete_pdf.m,
scripts/statistics/distributions/discrete_rnd.m,
scripts/statistics/distributions/empirical_rnd.m,
scripts/statistics/distributions/exprnd.m,
scripts/statistics/distributions/frnd.m,
scripts/statistics/distributions/gamrnd.m,
scripts/statistics/distributions/geornd.m,
scripts/statistics/distributions/hygernd.m,
scripts/statistics/distributions/kolmogorov_smirnov_cdf.m,
scripts/statistics/distributions/laplace_cdf.m,
scripts/statistics/distributions/laplace_pdf.m,
scripts/statistics/distributions/logistic_cdf.m,
scripts/statistics/distributions/logistic_pdf.m,
scripts/statistics/distributions/lognrnd.m,
scripts/statistics/distributions/nbincdf.m,
scripts/statistics/distributions/nbininv.m,
scripts/statistics/distributions/nbinpdf.m,
scripts/statistics/distributions/nbinrnd.m,
scripts/statistics/distributions/normrnd.m,
scripts/statistics/distributions/poissinv.m,
scripts/statistics/distributions/poissrnd.m,
scripts/statistics/distributions/tinv.m,
scripts/statistics/distributions/trnd.m,
scripts/statistics/distributions/unidcdf.m,
scripts/statistics/distributions/unidpdf.m,
scripts/statistics/distributions/unidrnd.m,
scripts/statistics/distributions/unifrnd.m,
scripts/statistics/distributions/wblrnd.m,
scripts/statistics/models/module.mk,
scripts/statistics/tests/kruskal_wallis_test.m,
scripts/strings/base2dec.m, scripts/strings/deblank.m,
scripts/strings/dec2base.m, scripts/strings/dec2bin.m,
scripts/strings/dec2hex.m, scripts/strings/mat2str.m,
scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m,
scripts/strings/str2num.m, scripts/strings/strcat.m,
scripts/strings/strjoin.m, scripts/strings/strsplit.m,
scripts/strings/strtok.m, scripts/strings/strtrim.m,
scripts/strings/strtrunc.m, scripts/strings/substr.m,
scripts/testfun/__run_test_suite__.m, scripts/testfun/speed.m,
scripts/testfun/test.m, scripts/time/asctime.m,
scripts/time/datenum.m, scripts/time/datevec.m,
scripts/time/weekday.m, src/Makefile.am, test/Makefile.am,
test/build-bc-overload-tests.sh, test/build-sparse-tests.sh,
test/jit.tst, test/line-continue.tst: Strip trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 08:26:57 -0500 |
parents | 175b392e91fe |
children | 0e1f5a750d00 |
rev | line source |
---|---|
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
1 /* |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
2 |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17220
diff
changeset
|
3 Copyright (C) 2005-2013 David Bateman |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
4 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
5 This file is part of Octave. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
6 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
10 option) any later version. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
11 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
15 for more details. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
16 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
20 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
21 */ |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
22 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
24 #include <config.h> |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
25 #endif |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
26 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
27 #include "ov.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
28 #include "defun-dld.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
29 #include "error.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
30 #include "gripes.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
31 #include "quit.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
32 #include "variables.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
33 #include "ov-re-sparse.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
34 #include "ov-cx-sparse.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
35 #include "oct-map.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
36 #include "pager.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
37 #include "unwind-prot.h" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
38 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
39 #include "eigs-base.cc" |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
40 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
41 // Global pointer for user defined function. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
42 static octave_function *eigs_fcn = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
43 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
44 // Have we warned about imaginary values returned from user function? |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
45 static bool warned_imaginary = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
46 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
47 // Is this a recursive call? |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
48 static int call_depth = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
49 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
50 ColumnVector |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
51 eigs_func (const ColumnVector &x, int &eigs_error) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
52 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
53 ColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
54 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
55 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
56 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
57 if (eigs_fcn) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
58 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
59 octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
60 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
61 if (error_state) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
62 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
63 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
64 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
65 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
66 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
67 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
68 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
69 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
70 if (! warned_imaginary && tmp(0).is_complex_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
71 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
72 warning ("eigs: ignoring imaginary part returned from user-supplied function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
73 warned_imaginary = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
74 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
75 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
76 retval = ColumnVector (tmp(0).vector_value ()); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
77 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
78 if (error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
79 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
80 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
81 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
82 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
83 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
84 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
85 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
86 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
87 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
88 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
89 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
90 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
91 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
92 } |
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 ComplexColumnVector |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
95 eigs_complex_func (const ComplexColumnVector &x, int &eigs_error) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
96 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
97 ComplexColumnVector retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
98 octave_value_list args; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
99 args(0) = x; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
100 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
101 if (eigs_fcn) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
102 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
103 octave_value_list tmp = eigs_fcn->do_multi_index_op (1, args); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
104 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
105 if (error_state) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
106 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
107 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
108 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
109 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
110 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
111 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
112 if (tmp.length () && tmp(0).is_defined ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
113 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
114 retval = ComplexColumnVector (tmp(0).complex_vector_value ()); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
115 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
116 if (error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
117 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
118 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
119 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
120 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
121 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
122 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
123 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
124 eigs_error = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
125 gripe_user_supplied_eval ("eigs"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
126 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
127 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
128 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
129 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
130 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
131 |
17220
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
132 DEFUN_DLD (__eigs__, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
133 "-*- texinfo -*-\n\ |
17220
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
134 @deftypefn {Loadable Function} {@var{d} =} __eigs__ (@var{A})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
135 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
136 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
137 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma}, @var{opts})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
138 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
139 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
140 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
141 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
142 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
143 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
144 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
145 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
146 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
147 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
148 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
149 @deftypefnx {Loadable Function} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
150 @deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} __eigs__ (@var{A}, @dots{})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
151 @deftypefnx {Loadable Function} {[@var{V}, @var{d}] =} __eigs__ (@var{af}, @var{n}, @dots{})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
152 @deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{A}, @dots{})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
153 @deftypefnx {Loadable Function} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{af}, @var{n}, @dots{})\n\ |
ea9992fd9c89
fix eigs to handle small matrices
John W. Eaton <jwe@octave.org>
parents:
15220
diff
changeset
|
154 Undocumented internal function.\n\ |
9724
f22bbc5d56e9
Fix various incorrect usages of TeXinfo deffn and deftypefn macros
Rik <rdrider0-list@yahoo.com>
parents:
9597
diff
changeset
|
155 @end deftypefn") |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
156 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
157 octave_value_list retval; |
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
|
158 #ifdef HAVE_ARPACK |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
159 int nargin = args.length (); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
160 std::string fcn_name; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
161 octave_idx_type n = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
162 octave_idx_type k = 6; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
163 Complex sigma = 0.; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
164 double sigmar, sigmai; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
165 bool have_sigma = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
166 std::string typ = "LM"; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
167 Matrix amm, bmm, bmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
168 ComplexMatrix acm, bcm, bct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
169 SparseMatrix asmm, bsmm, bsmt; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
170 SparseComplexMatrix ascm, bscm, bsct; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
171 int b_arg = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
172 bool have_b = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
173 bool have_a_fun = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
174 bool a_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
175 bool b_is_complex = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
176 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
|
177 bool sym_tested = false; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
178 bool cholB = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
179 bool a_is_sparse = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
180 ColumnVector permB; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
181 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
|
182 double tol = std::numeric_limits<double>::epsilon (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
183 int maxit = 300; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
184 int disp = 0; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
185 octave_idx_type p = -1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
186 ColumnVector resid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
187 ComplexColumnVector cresid; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
188 octave_idx_type info = 1; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
189 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
190 warned_imaginary = false; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
191 |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9758
diff
changeset
|
192 unwind_protect frame; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
193 |
10066
2cd940306a06
make unwind_protect frames local
Jaroslav Hajek <highegg@gmail.com>
parents:
9758
diff
changeset
|
194 frame.protect_var (call_depth); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
195 call_depth++; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
196 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
197 if (call_depth > 1) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
198 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
199 error ("eigs: invalid recursive call"); |
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
|
200 if (fcn_name.length ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
201 clear_function (fcn_name); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
202 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
203 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
204 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
205 if (nargin == 0) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
206 print_usage (); |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
207 else if (args(0).is_function_handle () || args(0).is_inline_function () |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
208 || args(0).is_string ()) |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
209 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
210 if (args(0).is_string ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
211 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
212 std::string name = args(0).string_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
213 std::string fname = "function y = "; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
214 fcn_name = unique_symbol_name ("__eigs_fcn_"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
215 fname.append (fcn_name); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
216 fname.append ("(x) y = "); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
217 eigs_fcn = extract_function (args(0), "eigs", fcn_name, fname, |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
218 "; endfunction"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
219 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
220 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
221 eigs_fcn = args(0).function_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
222 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
223 if (!eigs_fcn) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
224 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
225 error ("eigs: unknown function"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
226 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
227 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
228 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
229 if (nargin < 2) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
230 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
231 error ("eigs: incorrect number of arguments"); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
232 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
233 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
234 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
235 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
236 n = args(1).nint_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
237 arg_offset = 1; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
238 have_a_fun = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
239 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
240 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
241 else |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
242 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
243 if (args(0).is_complex_type ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
244 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
245 if (args(0).is_sparse_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
246 { |
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
|
247 ascm = (args(0).sparse_complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
248 a_is_sparse = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
249 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
250 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
|
251 acm = (args(0).complex_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
252 a_is_complex = true; |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
253 symmetric = false; // ARPACK doesn't special case complex symmetric |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
254 sym_tested = true; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
255 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
256 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
257 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
258 if (args(0).is_sparse_type ()) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
259 { |
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
|
260 asmm = (args(0).sparse_matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
261 a_is_sparse = true; |
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 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
264 { |
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
|
265 amm = (args(0).matrix_value ()); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
266 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
267 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
268 |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
269 } |
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
270 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
271 // Note hold off reading B till 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
|
272 // copies of the matrix if B is full/real while A is complex. |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
273 if (!error_state && nargin > 1 + arg_offset && |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
274 !(args(1 + arg_offset).is_real_scalar ())) |
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
275 { |
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
276 if (args(1+arg_offset).is_complex_type ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
277 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
278 b_arg = 1+arg_offset; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
279 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
280 b_is_complex = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
281 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
282 } |
9593
cf8403208c43
Fix nesting error in options parsing of eigs
David Bateman <dbateman@free.fr>
parents:
9377
diff
changeset
|
283 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
284 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
285 b_arg = 1+arg_offset; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
286 have_b = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
287 arg_offset++; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
288 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
289 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
290 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
291 if (!error_state && nargin > (1+arg_offset)) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
292 k = args(1+arg_offset).nint_value (); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
293 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
294 if (!error_state && 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
|
295 { |
8845
5a6db6bd1a02
eigs.cc (Feigs): fix handling of sigma arg
John W. Eaton <jwe@octave.org>
parents:
8702
diff
changeset
|
296 if (args(2+arg_offset).is_string ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
297 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
298 typ = args(2+arg_offset).string_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
299 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
300 // Use STL function to convert to upper case |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
301 transform (typ.begin (), typ.end (), typ.begin (), toupper); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
302 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
303 sigma = 0.; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
304 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
305 else |
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 sigma = args(2+arg_offset).complex_value (); |
8845
5a6db6bd1a02
eigs.cc (Feigs): fix handling of sigma arg
John W. Eaton <jwe@octave.org>
parents:
8702
diff
changeset
|
308 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
309 if (! error_state) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
310 have_sigma = true; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
311 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
312 { |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
313 error ("eigs: SIGMA must be a scalar or a string"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
314 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
315 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
316 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
317 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
318 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
319 sigmar = std::real (sigma); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
320 sigmai = std::imag (sigma); |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
321 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
322 if (!error_state && 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
|
323 { |
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
324 if (args(3+arg_offset).is_map ()) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
325 { |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
326 octave_scalar_map map = args(3+arg_offset).scalar_map_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
327 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
328 if (! error_state) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
329 { |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
330 octave_value tmp; |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
331 |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
332 // issym is ignored for complex matrix inputs |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
333 tmp = map.getfield ("issym"); |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
334 if (tmp.is_defined () && !sym_tested) |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
335 { |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
336 symmetric = tmp.double_value () != 0.; |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
337 sym_tested = true; |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
338 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
339 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
340 // isreal is ignored if A is not a function |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
341 tmp = map.getfield ("isreal"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
342 if (tmp.is_defined () && have_a_fun) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
343 a_is_complex = ! (tmp.double_value () != 0.); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
344 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
345 tmp = map.getfield ("tol"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
346 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
347 tol = tmp.double_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
348 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
349 tmp = map.getfield ("maxit"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
350 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
351 maxit = tmp.nint_value (); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
352 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
353 tmp = map.getfield ("p"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
354 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
355 p = tmp.nint_value (); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
356 |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
357 tmp = map.getfield ("v0"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
358 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
359 { |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
360 if (a_is_complex || b_is_complex) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
361 cresid = ComplexColumnVector (tmp.complex_vector_value ()); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
362 else |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
363 resid = ColumnVector (tmp.vector_value ()); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
364 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
365 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
366 tmp = map.getfield ("disp"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
367 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
368 disp = tmp.nint_value (); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
369 |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
370 tmp = map.getfield ("cholB"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
371 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
372 cholB = tmp.double_value () != 0.; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
373 |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
374 tmp = map.getfield ("permB"); |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
375 if (tmp.is_defined ()) |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
376 permB = ColumnVector (tmp.vector_value ()) - 1.0; |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
377 } |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
378 else |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
379 { |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
380 error ("eigs: OPTS argument must be a scalar structure"); |
11044
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
381 return retval; |
757249bb4888
eigs.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents:
10846
diff
changeset
|
382 } |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
383 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
384 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
385 { |
11553
01f703952eff
Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
386 error ("eigs: OPTS argument must be a structure"); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
387 return retval; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
388 } |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
389 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
390 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
391 if (nargin > (4+arg_offset)) |
8683
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
392 { |
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
393 error ("eigs: incorrect number of arguments"); |
e4f89f4a7cf8
eigs.cc (Feigs): avoid warnings; style fixes; return after errors
John W. Eaton <jwe@octave.org>
parents:
8585
diff
changeset
|
394 return retval; |
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 |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
397 // Test undeclared (no issym) matrix inputs for symmetry |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
398 if (!sym_tested && !have_a_fun) |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
399 { |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
400 if (a_is_sparse) |
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
|
401 symmetric = asmm.is_symmetric (); |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
402 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
|
403 symmetric = amm.is_symmetric (); |
12649
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
404 } |
8579e7a6e6e0
Improve performance (2X) of svds by avoiding issymmetric calculation (bug #33073)
Rik <octave@nomad.inbox5.com>
parents:
12329
diff
changeset
|
405 |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
406 if (have_b) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
407 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
408 if (a_is_complex || b_is_complex) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
409 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
410 if (a_is_sparse) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
411 bscm = args(b_arg).sparse_complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
412 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
413 bcm = args(b_arg).complex_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
414 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
415 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
416 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
417 if (a_is_sparse) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
418 bsmm = args(b_arg).sparse_matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
419 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
420 bmm = args(b_arg).matrix_value (); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
421 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
422 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
423 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
424 // 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
|
425 // Use Mode 3 instead, with sigma = 0. |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
426 if (!error_state && !have_sigma && typ == "SM") |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
427 have_sigma = true; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
428 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
429 if (!error_state) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
430 { |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
431 octave_idx_type nconv; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
432 if (a_is_complex || b_is_complex) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
433 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
434 ComplexMatrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
435 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
436 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
437 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
438 if (have_a_fun) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
439 nconv = EigsComplexNonSymmetricFunc |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
440 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
441 eig_val, cresid, octave_stdout, tol, (nargout > 1), cholB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
442 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
443 else if (have_sigma) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
444 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
445 if (a_is_sparse) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
446 nconv = EigsComplexNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
447 (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
448 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
449 maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
450 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
451 nconv = EigsComplexNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
452 (acm, sigma, k, p, info, eig_vec, eig_val, bcm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
453 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
454 maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
455 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
456 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
457 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
458 if (a_is_sparse) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
459 nconv = EigsComplexNonSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
460 (ascm, typ, k, p, info, eig_vec, eig_val, bscm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
461 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
462 maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
463 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
464 nconv = EigsComplexNonSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
465 (acm, typ, k, p, info, eig_vec, eig_val, bcm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
466 cresid, octave_stdout, tol, (nargout > 1), cholB, disp, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
467 maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
468 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
469 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
470 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
|
471 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
472 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
473 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
474 retval(2) = double (info); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
475 retval(1) = ComplexDiagMatrix (eig_val); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
476 retval(0) = eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
477 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
478 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
479 else if (sigmai != 0.) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
480 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
481 // Promote real problem to a complex one. |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
482 ComplexMatrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
483 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
484 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
485 if (have_a_fun) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
486 nconv = EigsComplexNonSymmetricFunc |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
487 (eigs_complex_func, n, typ, sigma, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
488 eig_val, cresid, octave_stdout, tol, (nargout > 1), cholB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
489 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
490 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
491 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
492 if (a_is_sparse) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
493 nconv = EigsComplexNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
494 (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
495 eig_val, SparseComplexMatrix (bsmm), permB, cresid, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
496 octave_stdout, tol, (nargout > 1), cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
497 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
498 nconv = EigsComplexNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
499 (ComplexMatrix (amm), sigma, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
500 eig_val, ComplexMatrix (bmm), permB, cresid, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
501 octave_stdout, tol, (nargout > 1), cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
502 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
503 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
504 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
|
505 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
506 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
507 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
508 retval(2) = double (info); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
509 retval(1) = ComplexDiagMatrix (eig_val); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
510 retval(0) = eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
511 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
512 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
513 else |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
514 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
515 if (symmetric) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
516 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
517 Matrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
518 ColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
519 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
520 if (have_a_fun) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
521 nconv = EigsRealSymmetricFunc |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
522 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
523 eig_val, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
524 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
525 else if (have_sigma) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
526 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
527 if (a_is_sparse) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
528 nconv = EigsRealSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
529 (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
530 permB, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
531 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
532 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
533 nconv = EigsRealSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
534 (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
535 permB, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
536 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
537 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
538 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
539 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
540 if (a_is_sparse) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
541 nconv = EigsRealSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
542 (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
543 permB, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
544 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
545 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
546 nconv = EigsRealSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
547 (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
548 resid, octave_stdout, tol, (nargout > 1), cholB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
549 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
550 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
551 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
552 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
|
553 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
554 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
555 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
556 retval(2) = double (info); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
557 retval(1) = DiagMatrix (eig_val); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
558 retval(0) = eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
559 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
560 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
561 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
562 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
563 ComplexMatrix eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
564 ComplexColumnVector eig_val; |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
565 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
566 if (have_a_fun) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
567 nconv = EigsRealNonSymmetricFunc |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
568 (eigs_func, n, typ, sigmar, k, p, info, eig_vec, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
569 eig_val, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
570 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
571 else if (have_sigma) |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
572 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
573 if (a_is_sparse) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
574 nconv = EigsRealNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
575 (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm, |
19627
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17787
diff
changeset
|
576 permB, resid, octave_stdout, tol, (nargout > 1), |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
577 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
578 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
579 nconv = EigsRealNonSymmetricMatrixShift |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
580 (amm, sigmar, k, p, info, eig_vec, eig_val, bmm, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
581 permB, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
582 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
583 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
584 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
585 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
586 if (a_is_sparse) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
587 nconv = EigsRealNonSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
588 (asmm, typ, k, p, info, eig_vec, eig_val, bsmm, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
589 permB, resid, octave_stdout, tol, (nargout > 1), |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
590 cholB, disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
591 else |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
592 nconv = EigsRealNonSymmetricMatrix |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
593 (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
594 resid, octave_stdout, tol, (nargout > 1), cholB, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
595 disp, maxit); |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
596 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
597 |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
598 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
|
599 retval(0) = eig_val; |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
600 else |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
601 { |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
602 retval(2) = double (info); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
603 retval(1) = ComplexDiagMatrix (eig_val); |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
604 retval(0) = eig_vec; |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
605 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
606 } |
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
607 } |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
608 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
609 if (nconv <= 0) |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
610 warning ("eigs: None of the %d requested eigenvalues converged", k); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
611 else if (nconv < k) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11553
diff
changeset
|
612 warning ("eigs: Only %d of the %d requested eigenvalues converged", |
10154
40dfc0c99116
DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents:
10066
diff
changeset
|
613 nconv, k); |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
614 } |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
615 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
616 if (! fcn_name.empty ()) |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
617 clear_function (fcn_name); |
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
|
618 #else |
834df9f10963
remove ARPACK files from sources and restore configure checks for external ARPACK library
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
619 error ("eigs: not available in this version of Octave"); |
834df9f10963
remove ARPACK files from sources and restore configure checks for external ARPACK library
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
620 #endif |
8417
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
621 |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
622 return retval; |
654bcfb937bf
Add the eigs and svds functions
David Bateman <dbateman@free.fr>
parents:
diff
changeset
|
623 } |