131 int nargin = args.
length ();
133 if (nargin < 1 || nargin > 2 || nargout > 2)
140 ord = args(1).xstring_value (
"schur: second argument must be a string");
142 bool force_complex =
false;
148 else if (ord ==
"complex")
150 force_complex =
true;
155 char ord_char = (ord.empty () ?
'U' : ord[0]);
157 if (ord_char !=
'U' && ord_char !=
'A' && ord_char !=
'D'
158 && ord_char !=
'u' && ord_char !=
'a' && ord_char !=
'd')
160 warning (
"schur: incorrect ordered schur argument '%s'",
179 if (! force_complex && arg.
isreal ())
185 math::schur<FloatMatrix> result (tmp, ord,
false);
186 retval =
ovl (result.schur_matrix ());
190 math::schur<FloatMatrix> result (tmp, ord,
true);
191 retval =
ovl (result.unitary_schur_matrix (),
192 result.schur_matrix ());
201 math::schur<FloatComplexMatrix> result (ctmp, ord,
false);
202 retval =
ovl (mark_upper_triangular (result.schur_matrix ()));
206 math::schur<FloatComplexMatrix> result (ctmp, ord,
true);
207 retval =
ovl (result.unitary_schur_matrix (),
208 mark_upper_triangular (result.schur_matrix ()));
214 if (! force_complex && arg.
isreal ())
220 math::schur<Matrix> result (tmp, ord,
false);
221 retval =
ovl (result.schur_matrix ());
225 math::schur<Matrix> result (tmp, ord,
true);
226 retval =
ovl (result.unitary_schur_matrix (),
227 result.schur_matrix ());
236 math::schur<ComplexMatrix> result (ctmp, ord,
false);
237 retval =
ovl (mark_upper_triangular (result.schur_matrix ()));
241 math::schur<ComplexMatrix> result (ctmp, ord,
true);
242 retval =
ovl (result.unitary_schur_matrix (),
243 mark_upper_triangular (result.schur_matrix ()));
292 if (args.length () != 2 || nargout > 2)
295 if (! args(0).isnumeric ())
297 if (! args(1).isnumeric ())
299 if (args(0).iscomplex () || args(1).iscomplex ())
300 error (
"rsf2csf: UR and TR must be real matrices");
302 if (args(0).is_single_type () || args(1).is_single_type ())
307 math::schur<FloatComplexMatrix> cs
308 = math::rsf2csf<FloatComplexMatrix, FloatMatrix> (t, u);
310 return ovl (cs.unitary_schur_matrix (), cs.schur_matrix ());
314 Matrix u = args(0).matrix_value ();
315 Matrix t = args(1).matrix_value ();
317 math::schur<ComplexMatrix> cs
318 = math::rsf2csf<ComplexMatrix, Matrix> (t, u);
320 return ovl (cs.unitary_schur_matrix (), cs.schur_matrix ());
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.