26 #if defined (HAVE_CONFIG_H)
42 template <
typename Matrix>
44 mark_upper_triangular (
const Matrix& a)
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
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
320 return ovl (cs.unitary_schur_matrix (), cs.schur_matrix ());
346 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type rows() const
octave_idx_type columns() const
octave_idx_type rows() const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
MatrixType matrix_type() const
bool is_single_type() const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
octave_idx_type columns() 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
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
void() error(const char *fmt,...)
#define error_unless(cond)
void err_square_matrix_required(const char *fcn, const char *name)
void err_wrong_type_arg(const char *name, const char *s)
schur< FloatComplexMatrix > rsf2csf< FloatComplexMatrix, FloatMatrix >(const FloatMatrix &s_arg, const FloatMatrix &u_arg)
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.
schur< RT > rsf2csf(const AT &s, const AT &u)