26 #if defined (HAVE_CONFIG_H)
41 DEFUN (eig, args, nargout,
104 int nargin = args.length ();
106 if (nargin > 4 || nargin == 0)
125 bool AEPcase = nargin == 1 || args(1).is_string ();
141 bool qz_flag =
false;
142 bool chol_flag =
false;
143 bool balance_flag =
false;
144 bool no_balance_flag =
false;
145 bool matrix_flag =
false;
146 bool vector_flag =
false;
148 for (
int i = (AEPcase ? 1 : 2); i < args.length (); ++i)
150 if (! args(i).is_string ())
153 std::string arg_i = args(i).string_value ();
161 no_balance_flag =
true;
167 error (R
"(eig: invalid option "%s")", arg_i.c_str ());
170 if (balance_flag && no_balance_flag)
171 error (R
"(eig: "balance" and "nobalance" options are mutually exclusive)");
172 if (vector_flag && matrix_flag)
173 error (R
"(eig: "vector" and "matrix" options are mutually exclusive)");
174 if (qz_flag && chol_flag)
175 error (R
"(eig: "qz" and "chol" options are mutually exclusive)");
180 error (R
"(eig: invalid "qz" option for algebraic eigenvalue problem)");
182 error (R
"(eig: invalid "chol" option for algebraic eigenvalue problem)");
187 error (R
"(eig: invalid "balance" option for generalized eigenvalue problem)");
189 error (R
"(eig: invalid "nobalance" option for generalized eigenvalue problem)");
193 const bool balance = (no_balance_flag ? false :
true);
194 const bool force_qz = qz_flag;
211 result =
FloatEIG (ftmp_a, nargout > 1, nargout > 2, balance);
217 result =
FloatEIG (fctmp_a, nargout > 1, nargout > 2, balance);
227 result =
FloatEIG (ftmp_a, ftmp_b, nargout > 1, nargout > 2,
235 result =
FloatEIG (fctmp_a, fctmp_b, nargout > 1, nargout > 2,
240 if (nargout == 0 || nargout == 1)
247 else if (nargout == 2)
277 result =
EIG (tmp_a, nargout > 1, nargout > 2, balance);
283 result =
EIG (ctmp_a, nargout > 1, nargout > 2, balance);
293 result =
EIG (tmp_a, tmp_b, nargout > 1, nargout > 2, force_qz);
300 result =
EIG (ctmp_a, ctmp_b, nargout > 1, nargout > 2, force_qz);
304 if (nargout == 0 || nargout == 1)
311 else if (nargout == 2)
ComplexMatrix right_eigenvectors(void) const
ComplexColumnVector eigenvalues(void) const
ComplexMatrix left_eigenvectors(void) const
FloatComplexColumnVector eigenvalues(void) const
FloatComplexMatrix left_eigenvectors(void) const
FloatComplexMatrix right_eigenvectors(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type rows(void) const
octave_idx_type columns(void) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
bool is_single_type(void) const
Matrix matrix_value(bool frc_str_conv=false) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
void err_square_matrix_required(const char *fcn, const char *name)
void err_wrong_type_arg(const char *name, const char *s)
OCTAVE_API bool strcmpi(const T &str_a, const T &str_b)
True if strings are the same, ignoring case.
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.