Mercurial > octave
diff libinterp/corefcn/schur.cc @ 21120:499b851fbfae
Replace pattern if/err_XXX/else/code with if/err_XXX/ code.
* schur.cc, ov-complex.h, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.h,
ov-flt-complex.h, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-range.cc,
ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.h, ov-str-mat.cc, ops.h, pt-idx.cc,
Array.cc, CColVector.cc, CMatrix.cc, CRowVector.cc, MSparse.cc, PermMatrix.cc,
Sparse.cc, dColVector.cc, dMatrix.cc, dRowVector.cc, dSparse.cc,
fCColVector.cc, fCMatrix.cc, fCRowVector.cc, fColVector.cc, fMatrix.cc,
fRowVector.cc:
Replace pattern if/err_XXX/else/code with if/err_XXX/ code.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 20 Jan 2016 16:58:59 -0800 |
parents | 3d0d84305600 |
children | 538b57866b90 |
line wrap: on
line diff
--- a/libinterp/corefcn/schur.cc Wed Jan 20 16:10:23 2016 -0800 +++ b/libinterp/corefcn/schur.cc Wed Jan 20 16:58:59 2016 -0800 @@ -169,11 +169,12 @@ if (nr != nc) err_square_matrix_required ("schur", "A"); + if (! arg.is_numeric_type ()) + err_wrong_type_arg ("schur", arg); + octave_value_list retval; - if (! arg.is_numeric_type ()) - err_wrong_type_arg ("schur", arg); - else if (arg.is_single_type ()) + if (arg.is_single_type ()) { if (! force_complex && arg.is_real_type ()) { @@ -291,37 +292,31 @@ if (args.length () != 2 || nargout > 2) print_usage (); - octave_value_list retval; - if (! args(0).is_numeric_type ()) err_wrong_type_arg ("rsf2csf", args(0)); - else if (! args(1).is_numeric_type ()) + if (! args(1).is_numeric_type ()) err_wrong_type_arg ("rsf2csf", args(1)); - else if (args(0).is_complex_type () || args(1).is_complex_type ()) + if (args(0).is_complex_type () || args(1).is_complex_type ()) error ("rsf2csf: UR and TR must be real matrices"); + + if (args(0).is_single_type () || args(1).is_single_type ()) + { + FloatMatrix u = args(0).float_matrix_value (); + FloatMatrix t = args(1).float_matrix_value (); + + FloatComplexSCHUR cs (FloatSCHUR (t, u)); + + return ovl (cs.unitary_matrix (), cs.schur_matrix ()); + } else { - if (args(0).is_single_type () || args(1).is_single_type ()) - { - FloatMatrix u = args(0).float_matrix_value (); - FloatMatrix t = args(1).float_matrix_value (); - - FloatComplexSCHUR cs (FloatSCHUR (t, u)); + Matrix u = args(0).matrix_value (); + Matrix t = args(1).matrix_value (); - retval = ovl (cs.unitary_matrix (), cs.schur_matrix ()); - } - else - { - Matrix u = args(0).matrix_value (); - Matrix t = args(1).matrix_value (); + ComplexSCHUR cs (SCHUR (t, u)); - ComplexSCHUR cs (SCHUR (t, u)); - - retval = ovl (cs.unitary_matrix (), cs.schur_matrix ()); - } + return ovl (cs.unitary_matrix (), cs.schur_matrix ()); } - - return retval; } /*