# HG changeset patch # User Antonius Burgers # Date 1640278011 -3600 # Thu Dec 23 17:46:51 2021 +0100 # Node ID 05e1abaf6f66dea3a05686161bb5acc5c3ad7d49 # Parent 74fe77faf861953683a78e67a1ae1ab7b3f1e58f inv: exit earlier when argument type not suitable for inv, improving consistency with matlab diff -r 74fe77faf861 -r 05e1abaf6f66 libinterp/corefcn/inv.cc --- a/libinterp/corefcn/inv.cc Wed Dec 22 18:29:15 2021 +0100 +++ b/libinterp/corefcn/inv.cc Thu Dec 23 17:46:51 2021 +0100 @@ -70,11 +70,14 @@ octave_value arg = args(0); + if (!(arg.isnumeric () || arg.islogical ())) + err_wrong_type_arg ("inv", arg); + if (arg.isempty ()) return ovl (Matrix ()); if (arg.rows () != arg.columns ()) - err_square_matrix_required ("inverse", "A"); + err_square_matrix_required ("inv", "A"); octave_value result; octave_idx_type info; @@ -191,6 +194,8 @@ } } else + // Shouldn't get here since we checked for suitable + // arg earlier. err_wrong_type_arg ("inv", arg); }