26#if defined (HAVE_CONFIG_H)
42template <
typename Matrix>
133 int nargin = args.length ();
135 if (nargin < 1 || nargin > 2 || nargout > 2)
142 ord = args(1).xstring_value (
"schur: second argument must be a string");
144 bool force_complex =
false;
150 else if (ord ==
"complex")
152 force_complex =
true;
157 char ord_char = (ord.empty () ?
'U' : ord[0]);
159 if (ord_char !=
'U' && ord_char !=
'A' && ord_char !=
'D'
160 && ord_char !=
'u' && ord_char !=
'a' && ord_char !=
'd')
162 warning (
"schur: incorrect ordered schur argument '%s'",
181 if (! force_complex && arg.
isreal ())
187 math::schur<FloatMatrix> result (tmp, ord,
false);
188 retval =
ovl (result.schur_matrix ());
192 math::schur<FloatMatrix> result (tmp, ord,
true);
193 retval =
ovl (result.unitary_schur_matrix (),
194 result.schur_matrix ());
203 math::schur<FloatComplexMatrix> result (ctmp, ord,
false);
208 math::schur<FloatComplexMatrix> result (ctmp, ord,
true);
209 retval =
ovl (result.unitary_schur_matrix (),
216 if (! force_complex && arg.
isreal ())
222 math::schur<Matrix> result (tmp, ord,
false);
223 retval =
ovl (result.schur_matrix ());
227 math::schur<Matrix> result (tmp, ord,
true);
228 retval =
ovl (result.unitary_schur_matrix (),
229 result.schur_matrix ());
238 math::schur<ComplexMatrix> result (ctmp, ord,
false);
243 math::schur<ComplexMatrix> result (ctmp, ord,
true);
244 retval =
ovl (result.unitary_schur_matrix (),
294 if (args.length () != 2 || nargout > 2)
297 if (! args(0).isnumeric ())
299 if (! args(1).isnumeric ())
301 if (args(0).iscomplex () || args(1).iscomplex ())
302 error (
"rsf2csf: UR and TR must be real matrices");
304 if (args(0).is_single_type () || args(1).is_single_type ())
309 math::schur<FloatComplexMatrix> cs
312 return ovl (cs.unitary_schur_matrix (), cs.schur_matrix ());
316 Matrix u = args(0).matrix_value ();
317 Matrix t = args(1).matrix_value ();
319 math::schur<ComplexMatrix> cs
322 return ovl (cs.unitary_schur_matrix (), cs.schur_matrix ());
octave_idx_type rows(void) const
octave_idx_type columns(void) const
MatrixType matrix_type(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type rows(void) const
bool isnumeric(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 warning(const char *fmt,...)
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)
static OCTAVE_NAMESPACE_BEGIN octave_value mark_upper_triangular(const Matrix &a)
OCTAVE_API schur< RT > rsf2csf(const AT &s, const AT &u)
OCTAVE_API schur< FloatComplexMatrix > rsf2csf< FloatComplexMatrix, FloatMatrix >(const FloatMatrix &s_arg, const FloatMatrix &u_arg)
OCTAVE_API schur< ComplexMatrix > rsf2csf< ComplexMatrix, Matrix >(const Matrix &s_arg, const Matrix &u_arg)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.