26 #if defined (HAVE_CONFIG_H)
39 DEFUN (eig, args, nargout,
102 int nargin = args.length ();
104 if (nargin > 4 || nargin == 0)
123 bool AEPcase = nargin == 1 || args(1).is_string ();
139 bool qz_flag =
false;
140 bool chol_flag =
false;
141 bool balance_flag =
false;
142 bool no_balance_flag =
false;
143 bool matrix_flag =
false;
144 bool vector_flag =
false;
146 for (
int i = (AEPcase ? 1 : 2); i < args.length (); ++i)
148 if (! args(i).is_string ())
151 std::string arg_i = args(i).string_value ();
159 no_balance_flag =
true;
165 error (R
"(eig: invalid option "%s")", arg_i.c_str ());
168 if (balance_flag && no_balance_flag)
169 error (R
"(eig: "balance" and "nobalance" options are mutually exclusive)");
170 if (vector_flag && matrix_flag)
171 error (R
"(eig: "vector" and "matrix" options are mutually exclusive)");
172 if (qz_flag && chol_flag)
173 error (R
"(eig: "qz" and "chol" options are mutually exclusive)");
178 error (R
"(eig: invalid "qz" option for algebraic eigenvalue problem)");
180 error (R
"(eig: invalid "chol" option for algebraic eigenvalue problem)");
185 error (R
"(eig: invalid "balance" option for generalized eigenvalue problem)");
187 error (R
"(eig: invalid "nobalance" option for generalized eigenvalue problem)");
191 const bool balance = (no_balance_flag ? false :
true);
192 const bool force_qz = qz_flag;
209 result =
FloatEIG (ftmp_a, nargout > 1, nargout > 2, balance);
215 result =
FloatEIG (fctmp_a, nargout > 1, nargout > 2, balance);
225 result =
FloatEIG (ftmp_a, ftmp_b, nargout > 1, nargout > 2,
233 result =
FloatEIG (fctmp_a, fctmp_b, nargout > 1, nargout > 2,
238 if (nargout == 0 || nargout == 1)
245 else if (nargout == 2)
275 result =
EIG (tmp_a, nargout > 1, nargout > 2, balance);
281 result =
EIG (ctmp_a, nargout > 1, nargout > 2, balance);
291 result =
EIG (tmp_a, tmp_b, nargout > 1, nargout > 2, force_qz);
298 result =
EIG (ctmp_a, ctmp_b, nargout > 1, nargout > 2, force_qz);
302 if (nargout == 0 || nargout == 1)
309 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
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)
bool strcmpi(const T &str_a, const T &str_b)
True if strings are the same, ignoring case.
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.