GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
__eigs__.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2005-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <limits>
31 #include <string>
32 
33 #include "Matrix.h"
34 #include "eigs-base.h"
35 #include "unwind-prot.h"
36 
37 #include "defun.h"
38 #include "error.h"
39 #include "errwarn.h"
40 #include "interpreter-private.h"
41 #include "oct-map.h"
42 #include "ov.h"
43 #include "ovl.h"
44 #include "pager.h"
45 #include "parse.h"
46 #include "variables.h"
47 
49 
50 #if defined (HAVE_ARPACK)
51 
53 {
54 public:
55 
57  eigs_func (const ColumnVector& x, int& eigs_error);
58 
60  eigs_complex_func (const ComplexColumnVector& x, int& eigs_error);
61 
62  //--------
63 
64  // Pointer for user defined function.
66 
67  // Have we warned about imaginary values returned from user function?
68  bool m_warned_imaginary = false;
69 };
70 
71 // Is this a recursive call?
72 static int call_depth = 0;
73 
75 eigs_callback::eigs_func (const ColumnVector& x, int& eigs_error)
76 {
77  ColumnVector retval;
78  octave_value_list args;
79  args(0) = x;
80 
81  if (m_eigs_fcn.is_defined ())
82  {
84 
85  try
86  {
87  tmp = octave::feval (m_eigs_fcn, args, 1);
88  }
89  catch (octave::execution_exception& ee)
90  {
91  err_user_supplied_eval (ee, "eigs");
92  }
93 
94  if (tmp.length () && tmp(0).is_defined ())
95  {
96  if (! m_warned_imaginary && tmp(0).iscomplex ())
97  {
98  warning ("eigs: ignoring imaginary part returned from user-supplied function");
99  m_warned_imaginary = true;
100  }
101 
102  retval = tmp(0).xvector_value ("eigs: evaluation of user-supplied function failed");
103  }
104  else
105  {
106  eigs_error = 1;
107  err_user_supplied_eval ("eigs");
108  }
109  }
110 
111  return retval;
112 }
113 
116  int& eigs_error)
117 {
118  ComplexColumnVector retval;
119  octave_value_list args;
120  args(0) = x;
121 
122  if (m_eigs_fcn.is_defined ())
123  {
124  octave_value_list tmp;
125 
126  try
127  {
128  tmp = octave::feval (m_eigs_fcn, args, 1);
129  }
130  catch (octave::execution_exception& ee)
131  {
132  err_user_supplied_eval (ee, "eigs");
133  }
134 
135  if (tmp.length () && tmp(0).is_defined ())
136  {
137  retval = tmp(0).xcomplex_vector_value ("eigs: evaluation of user-supplied function failed");
138  }
139  else
140  {
141  eigs_error = 1;
142  err_user_supplied_eval ("eigs");
143  }
144  }
145 
146  return retval;
147 }
148 
149 #endif
150 
151 DEFMETHOD (__eigs__, interp, args, nargout,
152  doc: /* -*- texinfo -*-
153 @deftypefn {} {@var{d} =} __eigs__ (@var{A})
154 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k})
155 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma})
156 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{k}, @var{sigma}, @var{opts})
157 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B})
158 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k})
159 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma})
160 @deftypefnx {} {@var{d} =} __eigs__ (@var{A}, @var{B}, @var{k}, @var{sigma}, @var{opts})
161 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n})
162 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B})
163 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k})
164 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k})
165 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma})
166 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma})
167 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{k}, @var{sigma}, @var{opts})
168 @deftypefnx {} {@var{d} =} __eigs__ (@var{af}, @var{n}, @var{B}, @var{k}, @var{sigma}, @var{opts})
169 @deftypefnx {} {[@var{V}, @var{d}] =} __eigs__ (@var{A}, @dots{})
170 @deftypefnx {} {[@var{V}, @var{d}] =} __eigs__ (@var{af}, @var{n}, @dots{})
171 @deftypefnx {} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{A}, @dots{})
172 @deftypefnx {} {[@var{V}, @var{d}, @var{flag}] =} __eigs__ (@var{af}, @var{n}, @dots{})
173 Undocumented internal function.
174 @end deftypefn */)
175 {
176 #if defined (HAVE_ARPACK)
177 
178  int nargin = args.length ();
179 
180  if (nargin == 0)
181  print_usage ();
182 
183  octave_value_list retval;
184 
185  std::string fcn_name;
186  octave_idx_type n = 0;
187  octave_idx_type k = 6;
188  Complex sigma = 0.0;
189  double sigmar, sigmai;
190  bool have_sigma = false;
191  std::string typ = "LM";
192  Matrix amm, bmm, bmt;
193  ComplexMatrix acm, bcm, bct;
194  SparseMatrix asmm, bsmm, bsmt;
195  SparseComplexMatrix ascm, bscm, bsct;
196  int b_arg = 0;
197  bool have_b = false;
198  bool have_a_fcn = false;
199  bool a_is_complex = false;
200  bool b_is_complex = false;
201  bool symmetric = false;
202  bool sym_tested = false;
203  bool cholB = false;
204  bool a_is_sparse = false;
205  bool b_is_sparse = false;
206  ColumnVector permB;
207  int arg_offset = 0;
208  double tol = std::numeric_limits<double>::epsilon ();
209  int maxit = 300;
210  int disp = 0;
211  octave_idx_type p = -1;
212  ColumnVector resid;
213  ComplexColumnVector cresid;
214  octave_idx_type info = 1;
215 
216  eigs_callback callback;
217 
218  unwind_protect_var<int> restore_var (call_depth);
219  call_depth++;
220 
221  if (call_depth > 1)
222  error ("eigs: invalid recursive call");
223 
224  if (args(0).is_function_handle () || args(0).is_inline_function ()
225  || args(0).is_string ())
226  {
227  callback.m_eigs_fcn = get_function_handle (interp, args(0), "x");
228 
229  if (callback.m_eigs_fcn.is_undefined ())
230  error ("eigs: unknown function");
231 
232  if (nargin < 2)
233  error ("eigs: incorrect number of arguments");
234 
235  n = args(1).nint_value ();
236  arg_offset = 1;
237  have_a_fcn = true;
238  }
239  else
240  {
241  if (args(0).iscomplex ())
242  {
243  if (args(0).issparse ())
244  {
245  ascm = (args(0).sparse_complex_matrix_value ());
246  a_is_sparse = true;
247  }
248  else
249  acm = (args(0).complex_matrix_value ());
250  a_is_complex = true;
251  }
252  else
253  {
254  if (args(0).issparse ())
255  {
256  asmm = (args(0).sparse_matrix_value ());
257  a_is_sparse = true;
258  }
259  else
260  {
261  amm = (args(0).matrix_value ());
262  }
263  }
264  }
265 
266  // Note hold off reading B until later to avoid issues of double
267  // copies of the matrix if B is full/real while A is complex.
268  if (nargin > 1 + arg_offset
269  && ! (args(1 + arg_offset).is_real_scalar ()))
270  {
271  if (args(1+arg_offset).iscomplex ())
272  {
273  b_arg = 1+arg_offset;
274  if (args(b_arg).issparse ())
275  {
276  bscm = (args(b_arg).sparse_complex_matrix_value ());
277  b_is_sparse = true;
278  }
279  else
280  bcm = (args(b_arg).complex_matrix_value ());
281  have_b = true;
282  b_is_complex = true;
283  arg_offset++;
284  }
285  else
286  {
287  b_arg = 1+arg_offset;
288  if (args(b_arg).issparse ())
289  {
290  bsmm = (args(b_arg).sparse_matrix_value ());
291  b_is_sparse = true;
292  }
293  else
294  bmm = (args(b_arg).matrix_value ());
295  have_b = true;
296  arg_offset++;
297  }
298  }
299 
300  if (nargin > (1+arg_offset))
301  k = args(1+arg_offset).nint_value ();
302 
303  if (nargin > (2+arg_offset))
304  {
305  if (args(2+arg_offset).is_string ())
306  {
307  typ = args(2+arg_offset).string_value ();
308 
309  // Use STL function to convert to upper case
310  transform (typ.begin (), typ.end (), typ.begin (), toupper);
311 
312  sigma = 0.0;
313  }
314  else
315  {
316  sigma = args(2+arg_offset).xcomplex_value ("eigs: SIGMA must be a scalar or a string");
317 
318  have_sigma = true;
319  }
320  }
321 
322  sigmar = sigma.real ();
323  sigmai = sigma.imag ();
324 
325  if (nargin > (3+arg_offset))
326  {
327  if (! args(3+arg_offset).isstruct ())
328  error ("eigs: OPTS argument must be a structure");
329 
330  octave_scalar_map map = args(3
331  +arg_offset).xscalar_map_value ("eigs: OPTS argument must be a scalar structure");
332 
333  octave_value tmp;
334 
335  // issym is ignored for complex matrix inputs
336  tmp = map.getfield ("issym");
337  if (tmp.is_defined ())
338  {
339  if (tmp.numel () != 1)
340  error ("eigs: OPTS.issym must be a scalar value");
341 
342  symmetric = tmp.xbool_value ("eigs: OPTS.issym must be a logical value");
343  sym_tested = true;
344  }
345 
346  // isreal is ignored if A is not a function
347  if (have_a_fcn)
348  {
349  tmp = map.getfield ("isreal");
350  if (tmp.is_defined ())
351  {
352  if (tmp.numel () != 1)
353  error ("eigs: OPTS.isreal must be a scalar value");
354 
355  a_is_complex = ! tmp.xbool_value ("eigs: OPTS.isreal must be a logical value");
356  }
357  }
358 
359  tmp = map.getfield ("tol");
360  if (tmp.is_defined ())
361  tol = tmp.double_value ();
362 
363  tmp = map.getfield ("maxit");
364  if (tmp.is_defined ())
365  maxit = tmp.nint_value ();
366 
367  tmp = map.getfield ("p");
368  if (tmp.is_defined ())
369  p = tmp.nint_value ();
370 
371  tmp = map.getfield ("v0");
372  if (tmp.is_defined ())
373  {
374  if (a_is_complex || b_is_complex)
375  cresid = ComplexColumnVector (tmp.complex_vector_value ());
376  else
377  resid = ColumnVector (tmp.vector_value ());
378  }
379 
380  tmp = map.getfield ("disp");
381  if (tmp.is_defined ())
382  disp = tmp.nint_value ();
383 
384  tmp = map.getfield ("cholB");
385  if (tmp.is_defined ())
386  {
387  if (tmp.numel () != 1)
388  error ("eigs: OPTS.cholB must be a scalar value");
389 
390  cholB = tmp.xbool_value ("eigs: OPTS.cholB must be a logical value");
391  }
392 
393  tmp = map.getfield ("permB");
394  if (tmp.is_defined ())
395  permB = ColumnVector (tmp.vector_value ()) - 1.0;
396  }
397 
398  if (nargin > (4+arg_offset))
399  error ("eigs: incorrect number of arguments");
400 
401  // Test undeclared (no issym) matrix inputs for symmetry
402  if (! sym_tested && ! have_a_fcn)
403  {
404  if (a_is_complex)
405  {
406  if (a_is_sparse)
407  symmetric = ascm.ishermitian ();
408  else
409  symmetric = acm.ishermitian ();
410  }
411  else
412  {
413  if (a_is_sparse)
414  symmetric = asmm.issymmetric ();
415  else
416  symmetric = amm.issymmetric ();
417  }
418  }
419 
420  if (have_b)
421  {
422  if (a_is_complex || b_is_complex)
423  {
424  if (b_is_sparse)
425  bscm = args(b_arg).sparse_complex_matrix_value ();
426  else
427  bcm = args(b_arg).complex_matrix_value ();
428  }
429  else
430  {
431  if (b_is_sparse)
432  bsmm = args(b_arg).sparse_matrix_value ();
433  else
434  bmm = args(b_arg).matrix_value ();
435  }
436  }
437 
438  // Mode 1 for SM mode seems unstable for some reason.
439  // Use Mode 3 instead, with sigma = 0.
440  if (! have_sigma && typ == "SM")
441  have_sigma = true;
442 
443  octave_idx_type nconv;
444  if (a_is_complex || b_is_complex)
445  {
447  eigs_complex_fcn = [&callback] (const ComplexColumnVector& x,
448  int& eigs_error)
449  {
450  return callback.eigs_complex_func (x, eigs_error);
451  };
452 
453  ComplexMatrix eig_vec;
454  ComplexColumnVector eig_val;
455 
456  if (have_a_fcn)
457  {
458  if (b_is_sparse)
460  (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec,
461  eig_val, bscm, permB, cresid, octave_stdout, tol,
462  (nargout > 1), cholB, disp, maxit);
463  else
465  (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec,
466  eig_val, bcm, permB, cresid, octave_stdout, tol,
467  (nargout > 1), cholB, disp, maxit);
468  }
469  else if (have_sigma)
470  {
471  if (a_is_sparse)
473  (ascm, sigma, k, p, info, eig_vec, eig_val, bscm, permB,
474  cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
475  maxit);
476  else
478  (acm, sigma, k, p, info, eig_vec, eig_val, bcm, permB,
479  cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
480  maxit);
481  }
482  else
483  {
484  if (a_is_sparse)
486  (ascm, typ, k, p, info, eig_vec, eig_val, bscm, permB,
487  cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
488  maxit);
489  else
491  (acm, typ, k, p, info, eig_vec, eig_val, bcm, permB,
492  cresid, octave_stdout, tol, (nargout > 1), cholB, disp,
493  maxit);
494  }
495 
496  if (nargout < 2)
497  {
498  if (symmetric)
499  retval(0) = real (eig_val);
500  else
501  retval(0) = eig_val;
502  }
503  else
504  {
505  if (symmetric)
506  retval = ovl (eig_vec, DiagMatrix (real (eig_val)), double (info));
507  else
508  retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info));
509  }
510  }
511  else if (sigmai != 0.0)
512  {
514  eigs_complex_fcn = [&callback] (const ComplexColumnVector& x,
515  int& eigs_error)
516  {
517  return callback.eigs_complex_func (x, eigs_error);
518  };
519 
520  // Promote real problem to a complex one.
521  ComplexMatrix eig_vec;
522  ComplexColumnVector eig_val;
523 
524  if (have_a_fcn)
525  {
526  if (b_is_sparse)
528  (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec,
529  eig_val, bscm, permB, cresid, octave_stdout, tol,
530  (nargout > 1), cholB, disp, maxit);
531  else
533  (eigs_complex_fcn, n, typ, sigma, k, p, info, eig_vec,
534  eig_val, bcm, permB, cresid, octave_stdout, tol,
535  (nargout > 1), cholB, disp, maxit);
536  }
537  else
538  {
539  if (a_is_sparse)
541  (SparseComplexMatrix (asmm), sigma, k, p, info, eig_vec,
542  eig_val, SparseComplexMatrix (bsmm), permB, cresid,
543  octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
544  else
546  (ComplexMatrix (amm), sigma, k, p, info, eig_vec,
547  eig_val, ComplexMatrix (bmm), permB, cresid,
548  octave_stdout, tol, (nargout > 1), cholB, disp, maxit);
549  }
550 
551  if (nargout < 2)
552  {
553  if (symmetric)
554  retval(0) = real (eig_val);
555  else
556  retval(0) = eig_val;
557  }
558  else
559  {
560  if (symmetric)
561  retval = ovl (eig_vec, DiagMatrix (real (eig_val)), double (info));
562  else
563  retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info));
564  }
565  }
566  else
567  {
568  EigsFunc eigs_fcn = [&callback] (const ColumnVector& x, int& eigs_error)
569  {
570  return callback.eigs_func (x, eigs_error);
571  };
572 
573  if (symmetric)
574  {
575  Matrix eig_vec;
576  ColumnVector eig_val;
577 
578  if (have_a_fcn)
579  {
580  if (b_is_sparse)
581  nconv = EigsRealSymmetricFunc
582  (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec,
583  eig_val, bsmm, permB, resid, octave_stdout, tol,
584  (nargout > 1), cholB, disp, maxit);
585  else
586  nconv = EigsRealSymmetricFunc
587  (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec,
588  eig_val, bmm, permB, resid, octave_stdout, tol,
589  (nargout > 1), cholB, disp, maxit);
590  }
591  else if (have_sigma)
592  {
593  if (a_is_sparse)
595  (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm,
596  permB, resid, octave_stdout, tol, (nargout > 1),
597  cholB, disp, maxit);
598  else
600  (amm, sigmar, k, p, info, eig_vec, eig_val, bmm,
601  permB, resid, octave_stdout, tol, (nargout > 1),
602  cholB, disp, maxit);
603  }
604  else
605  {
606  if (a_is_sparse)
608  (asmm, typ, k, p, info, eig_vec, eig_val, bsmm,
609  permB, resid, octave_stdout, tol, (nargout > 1),
610  cholB, disp, maxit);
611  else
613  (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
614  resid, octave_stdout, tol, (nargout > 1), cholB,
615  disp, maxit);
616  }
617 
618  if (nargout < 2)
619  retval(0) = eig_val;
620  else
621  retval = ovl (eig_vec, DiagMatrix (eig_val), double (info));
622  }
623  else
624  {
625  ComplexMatrix eig_vec;
626  ComplexColumnVector eig_val;
627 
628  if (have_a_fcn)
629  {
630  if (b_is_sparse)
632  (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec,
633  eig_val, bsmm, permB, resid, octave_stdout, tol,
634  (nargout > 1), cholB, disp, maxit);
635  else
637  (eigs_fcn, n, typ, sigmar, k, p, info, eig_vec,
638  eig_val, bmm, permB, resid, octave_stdout, tol,
639  (nargout > 1), cholB, disp, maxit);
640  }
641  else if (have_sigma)
642  {
643  if (a_is_sparse)
645  (asmm, sigmar, k, p, info, eig_vec, eig_val, bsmm,
646  permB, resid, octave_stdout, tol, (nargout > 1),
647  cholB, disp, maxit);
648  else
650  (amm, sigmar, k, p, info, eig_vec, eig_val, bmm,
651  permB, resid, octave_stdout, tol, (nargout > 1),
652  cholB, disp, maxit);
653  }
654  else
655  {
656  if (a_is_sparse)
658  (asmm, typ, k, p, info, eig_vec, eig_val, bsmm,
659  permB, resid, octave_stdout, tol, (nargout > 1),
660  cholB, disp, maxit);
661  else
663  (amm, typ, k, p, info, eig_vec, eig_val, bmm, permB,
664  resid, octave_stdout, tol, (nargout > 1), cholB,
665  disp, maxit);
666  }
667 
668  if (nargout < 2)
669  retval(0) = eig_val;
670  else
671  retval = ovl (eig_vec, ComplexDiagMatrix (eig_val), double (info));
672  }
673  }
674 
675  if (nconv <= 0)
676  warning_with_id ("Octave:eigs:UnconvergedEigenvalues",
677  "eigs: None of the %" OCTAVE_IDX_TYPE_FORMAT
678  " requested eigenvalues converged", k);
679  else if (nconv < k)
680  warning_with_id ("Octave:eigs:UnconvergedEigenvalues",
681  "eigs: Only %" OCTAVE_IDX_TYPE_FORMAT
682  " of the %" OCTAVE_IDX_TYPE_FORMAT
683  " requested eigenvalues converged",
684  nconv, k);
685 
686  if (! fcn_name.empty ())
687  {
688  symbol_table& symtab = interp.get_symbol_table ();
689 
690  symtab.clear_function (fcn_name);
691  }
692 
693  return retval;
694 
695 #else
696 
697  octave_unused_parameter (interp);
698  octave_unused_parameter (args);
699  octave_unused_parameter (nargout);
700 
701  err_disabled_feature ("eigs", "ARPACK");
702 
703 #endif
704 }
705 
706 /*
707 ## No test needed for internal helper function.
708 %!assert (1)
709 */
710 
OCTAVE_END_NAMESPACE(octave)
static int call_depth
Definition: __eigs__.cc:72
OCTAVE_API bool ishermitian(void) const
Definition: CMatrix.cc:174
Definition: dMatrix.h:42
OCTAVE_API bool issymmetric(void) const
Definition: dMatrix.cc:136
OCTAVE_API bool ishermitian(void) const
Definition: CSparse.cc:142
OCTAVE_API bool issymmetric(void) const
Definition: dSparse.cc:131
octave_value getfield(const std::string &key) const
Definition: oct-map.cc:183
octave_idx_type length(void) const
Definition: ovl.h:113
OCTINTERP_API Array< Complex > complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type numel(void) const
Definition: ov.h:604
bool is_defined(void) const
Definition: ov.h:637
int nint_value(bool frc_str_conv=false) const
Definition: ov.h:864
OCTINTERP_API bool xbool_value(const char *fmt,...) const
bool is_undefined(void) const
Definition: ov.h:640
OCTINTERP_API Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
double double_value(bool frc_str_conv=false) const
Definition: ov.h:886
void clear_function(const std::string &name)
Definition: symtab.cc:434
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:137
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
Definition: defun-int.h:72
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:111
octave_idx_type EigsRealNonSymmetricMatrixShift(const M &m, double sigmar, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:2113
octave_idx_type EigsRealSymmetricMatrixShift(const M &m, double sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:1078
octave_idx_type EigsRealNonSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:1762
octave_idx_type EigsComplexNonSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:2927
octave_idx_type EigsRealSymmetricFunc(EigsFunc fcn, octave_idx_type n_arg, const std::string &_typ, double sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:1381
octave_idx_type EigsRealNonSymmetricFunc(EigsFunc fcn, octave_idx_type n_arg, const std::string &_typ, double sigmar, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:2485
octave_idx_type EigsComplexNonSymmetricMatrixShift(const M &m, Complex sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:3230
octave_idx_type EigsRealSymmetricMatrix(const M &m, const std::string typ, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, Matrix &eig_vec, ColumnVector &eig_val, const M &_b, ColumnVector &permB, ColumnVector &resid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:786
octave_idx_type EigsComplexNonSymmetricFunc(EigsComplexFunc fcn, octave_idx_type n_arg, const std::string &_typ, Complex sigma, octave_idx_type k_arg, octave_idx_type p_arg, octave_idx_type &info, ComplexMatrix &eig_vec, ComplexColumnVector &eig_val, const M &_b, ColumnVector &permB, ComplexColumnVector &cresid, std::ostream &os, double tol, bool rvec, bool cholB, int disp, int maxit)
Definition: eigs-base.cc:3553
std::function< ColumnVector(const ColumnVector &x, int &eigs_error)> EigsFunc
Definition: eigs-base.h:39
std::function< ComplexColumnVector(const ComplexColumnVector &x, int &eigs_error)> EigsComplexFunc
Definition: eigs-base.h:43
void warning(const char *fmt,...)
Definition: error.cc:1054
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:1069
void error(const char *fmt,...)
Definition: error.cc:979
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
Definition: errwarn.cc:53
void err_user_supplied_eval(const char *name)
Definition: errwarn.cc:152
ColumnVector transform(const Matrix &m, double x, double y, double z)
Definition: graphics.cc:5819
octave_value get_function_handle(interpreter &interp, const octave_value &arg, const std::string &parameter_name)
F77_RET_T const F77_DBLE * x
class OCTAVE_API ComplexColumnVector
Definition: mx-fwd.h:46
class OCTAVE_API ColumnVector
Definition: mx-fwd.h:45
octave_idx_type n
Definition: mx-inlines.cc:753
std::complex< double > Complex
Definition: oct-cmplx.h:33
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
Definition: oct-parse.cc:10370
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211
#define octave_stdout
Definition: pager.h:314
bool m_warned_imaginary
Definition: __eigs__.cc:68
ComplexColumnVector eigs_complex_func(const ComplexColumnVector &x, int &eigs_error)
Definition: __eigs__.cc:115
ColumnVector eigs_func(const ColumnVector &x, int &eigs_error)
Definition: __eigs__.cc:75
octave_value m_eigs_fcn
Definition: __eigs__.cc:65