Mercurial > jwe > octave
changeset 21110:3d0d84305600
Use err_square_matrix_required more widely.
* errwarn.h (err_square_matrix_required): Change prototype to take a second
argument which is the name of the variable that is not square.
* errwarn.cc (err_square_matrix_required): Take second argument NAME and
print "NAME must be a square matrix".
* balance.cc (Fbalance): Update calling form of err_square_matrix_required.
* det.cc (Fdet): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* eig.cc (Feig): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* hess.cc (Fhess): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* inv.cc (Finv): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* qz.cc (Fqz): Update calling form of err_square_matrix_required.
* schur.cc (Fschur): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* sqrtm.cc (Fsqrtm): Update calling form of err_square_matrix_required.
* sylvester.cc (Fsylvester): Update calling form of err_square_matrix_required.
Update pattern in BIST tests to match new output.
* amd.cc (Famd): Switch from error to err_square_matrix_required.
Update pattern in BIST tests to match new output.
* ccolamd.cc (Fcsymamd): Switch from error to err_square_matrix_required.
* chol.cc (Fcholdelete, Fcholshift): Switch from error to
err_square_matrix_required.
* colamd.cc (Fsymamd): Switch from error to err_square_matrix_required.
* symbfact.cc (Fsymfact): Switch from error to err_square_matrix_required.
* symrcm.cc (Fsymrcm): Update calling form of err_square_matrix_required.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 19 Jan 2016 14:09:56 -0800 |
parents | bd1752782e56 |
children | 7bb96a8df912 |
files | libinterp/corefcn/balance.cc libinterp/corefcn/det.cc libinterp/corefcn/eig.cc libinterp/corefcn/errwarn.cc libinterp/corefcn/errwarn.h libinterp/corefcn/hess.cc libinterp/corefcn/inv.cc libinterp/corefcn/qz.cc libinterp/corefcn/schur.cc libinterp/corefcn/sqrtm.cc libinterp/corefcn/sylvester.cc libinterp/dldfcn/amd.cc libinterp/dldfcn/ccolamd.cc libinterp/dldfcn/chol.cc libinterp/dldfcn/colamd.cc libinterp/dldfcn/symbfact.cc libinterp/dldfcn/symrcm.cc |
diffstat | 17 files changed, 35 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/balance.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/balance.cc Tue Jan 19 14:09:56 2016 -0800 @@ -105,7 +105,7 @@ octave_idx_type nn = args(0).rows (); if (nn != args(0).columns ()) - err_square_matrix_required ("balance"); + err_square_matrix_required ("balance", "A"); bool isfloat = args(0).is_single_type () || (! AEPcase && args(1).is_single_type ());
--- a/libinterp/corefcn/det.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/det.cc Tue Jan 19 14:09:56 2016 -0800 @@ -82,7 +82,7 @@ return octave_value (1.0); if (nr != nc) - err_square_matrix_required ("det"); + err_square_matrix_required ("det", "A"); octave_value_list retval (2); @@ -237,5 +237,5 @@ %!assert (det (single ([1, 2; 3, 4])), single (-2), 10*eps ("single")) %!error det () %!error det (1, 2) -%!error <argument must be a square matrix> det ([1, 2; 3, 4; 5, 6]) +%!error <must be a square matrix> det ([1, 2; 3, 4; 5, 6]) */
--- a/libinterp/corefcn/eig.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/eig.cc Tue Jan 19 14:09:56 2016 -0800 @@ -98,10 +98,10 @@ } if (nr_a != nc_a) - err_square_matrix_required ("eig"); + err_square_matrix_required ("eig", "A"); if (nargin == 2 && nr_b != nc_b) - err_square_matrix_required ("eig"); + err_square_matrix_required ("eig", "B"); Matrix tmp_a, tmp_b; ComplexMatrix ctmp_a, ctmp_b; @@ -296,7 +296,7 @@ %!error eig () %!error eig ([1, 2; 3, 4], [4, 3; 2, 1], 1) %!error <EIG requires same size matrices> eig ([1, 2; 3, 4], 2) -%!error <argument must be a square matrix> eig ([1, 2; 3, 4; 5, 6]) +%!error <must be a square matrix> eig ([1, 2; 3, 4; 5, 6]) %!error <wrong type argument> eig ("abcd") %!error <wrong type argument> eig ([1 2 ; 2 3], "abcd") %!error <wrong type argument> eig (false, [1 2 ; 2 3])
--- a/libinterp/corefcn/errwarn.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/errwarn.cc Tue Jan 19 14:09:56 2016 -0800 @@ -109,9 +109,9 @@ } void -err_square_matrix_required (const char *name) +err_square_matrix_required (const char *fcn, const char *name) { - error ("%s: argument must be a square matrix", name); + error ("%s: %s must be a square matrix", fcn, name); } void
--- a/libinterp/corefcn/errwarn.h Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/errwarn.h Tue Jan 19 14:09:56 2016 -0800 @@ -71,7 +71,7 @@ void err_range_invalid (void); OCTAVE_NORETURN OCTINTERP_API extern -void err_square_matrix_required (const char *name); +void err_square_matrix_required (const char *fcn, const char *name); OCTAVE_NORETURN OCTINTERP_API extern void err_string_invalid (void);
--- a/libinterp/corefcn/hess.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/hess.cc Tue Jan 19 14:09:56 2016 -0800 @@ -80,7 +80,7 @@ return octave_value_list (2, Matrix ()); if (nr != nc) - err_square_matrix_required ("hess"); + err_square_matrix_required ("hess", "A"); octave_value_list retval; @@ -159,5 +159,5 @@ %!error hess () %!error hess ([1, 2; 3, 4], 2) -%!error <argument must be a square matrix> hess ([1, 2; 3, 4; 5, 6]) +%!error <must be a square matrix> hess ([1, 2; 3, 4; 5, 6]) */
--- a/libinterp/corefcn/inv.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/inv.cc Tue Jan 19 14:09:56 2016 -0800 @@ -74,7 +74,7 @@ return octave_value (Matrix ()); if (nr != nc) - err_square_matrix_required ("inverse"); + err_square_matrix_required ("inverse", "A"); octave_value result; octave_idx_type info; @@ -217,7 +217,7 @@ %!error inv () %!error inv ([1, 2; 3, 4], 2) -%!error <argument must be a square matrix> inv ([1, 2; 3, 4; 5, 6]) +%!error <must be a square matrix> inv ([1, 2; 3, 4; 5, 6]) %!test %! [xinv, rcond] = inv (single ([1,2;3,4]));
--- a/libinterp/corefcn/qz.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/qz.cc Tue Jan 19 14:09:56 2016 -0800 @@ -469,7 +469,7 @@ return octave_value_list (2, Matrix ()); } else if (args(0).columns () != nn) - err_square_matrix_required ("qz"); + err_square_matrix_required ("qz", "A"); // Argument 1: dimensions look good; get the value. Matrix aa;
--- a/libinterp/corefcn/schur.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/schur.cc Tue Jan 19 14:09:56 2016 -0800 @@ -167,7 +167,7 @@ octave_idx_type nc = arg.columns (); if (nr != nc) - err_square_matrix_required ("schur"); + err_square_matrix_required ("schur", "A"); octave_value_list retval; @@ -261,7 +261,7 @@ %!error schur () %!error schur (1,2,3) %!error [a,b,c] = schur (1) -%!error <argument must be a square matrix> schur ([1, 2, 3; 4, 5, 6]) +%!error <must be a square matrix> schur ([1, 2, 3; 4, 5, 6]) %!error <wrong type argument 'cell'> schur ({1}) %!warning <incorrect ordered schur argument> schur ([1, 2; 3, 4], "bad_opt");
--- a/libinterp/corefcn/sqrtm.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/sqrtm.cc Tue Jan 19 14:09:56 2016 -0800 @@ -221,7 +221,7 @@ octave_idx_type nc = arg.columns (); if (n != nc || arg.ndims () > 2) - err_square_matrix_required ("sqrtm"); + err_square_matrix_required ("sqrtm", "A"); octave_value_list retval (nargout > 1 ? 3 : 1);
--- a/libinterp/corefcn/sylvester.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/corefcn/sylvester.cc Tue Jan 19 14:09:56 2016 -0800 @@ -97,10 +97,10 @@ // Arguments are not empty, so check for correct dimensions. if (a_nr != a_nc) - err_square_matrix_required ("sylvester: input A"); - else if (b_nr != b_nc) - err_square_matrix_required ("sylvester: input B"); - else if (a_nr != c_nr || b_nr != c_nc) + err_square_matrix_required ("sylvester", "A"); + if (b_nr != b_nc) + err_square_matrix_required ("sylvester", "B"); + if (a_nr != c_nr || b_nr != c_nc) err_nonconformant (); if (isfloat) @@ -166,7 +166,7 @@ %!error sylvester (1) %!error sylvester (1,2) %!error sylvester (1, 2, 3, 4) -%!error <input A: .* must be a square matrix> sylvester (ones (2,3), ones (2,2), ones (2,2)) -%!error <input B: .* must be a square matrix> sylvester (ones (2,2), ones (2,3), ones (2,2)) +%!error <A must be a square matrix> sylvester (ones (2,3), ones (2,2), ones (2,2)) +%!error <B must be a square matrix> sylvester (ones (2,2), ones (2,3), ones (2,2)) %!error <nonconformant matrices> sylvester (ones (2,2), ones (2,2), ones (3,3)) */
--- a/libinterp/dldfcn/amd.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/amd.cc Tue Jan 19 14:09:56 2016 -0800 @@ -34,6 +34,7 @@ #include "ov.h" #include "defun-dld.h" +#include "errwarn.h" #include "pager.h" #include "ov-re-mat.h" @@ -128,7 +129,7 @@ } if (n_row != n_col) - error ("amd: matrix S must be square"); + err_square_matrix_required ("amd", "S"); OCTAVE_LOCAL_BUFFER (double, Control, AMD_CONTROL); AMD_NAME (_defaults) (Control) ; @@ -193,7 +194,7 @@ %! opts.aggressive = 1; %! assert(amd (A2, opts), [1:30]) -%!error <matrix S must be square|not available in this version> amd (A) +%!error <S must be a square matrix|was unavailable or disabled> amd (A) %!error amd (A2, 2) -%!error <matrix S is corrupted|not available in this version> amd ([]) +%!error <matrix S is corrupted|was unavailable or disabled> amd ([]) */
--- a/libinterp/dldfcn/ccolamd.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/ccolamd.cc Tue Jan 19 14:09:56 2016 -0800 @@ -34,6 +34,7 @@ #include "ov.h" #include "defun-dld.h" +#include "errwarn.h" #include "pager.h" #include "ov-re-mat.h" @@ -493,7 +494,7 @@ } if (n_row != n_col) - error ("csymamd: matrix S must be square"); + err_square_matrix_required ("csymamd", "S"); // Allocate workspace for symamd OCTAVE_LOCAL_BUFFER (octave_idx_type, perm, n_col+1);
--- a/libinterp/dldfcn/chol.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/chol.cc Tue Jan 19 14:09:56 2016 -0800 @@ -1015,7 +1015,7 @@ octave_idx_type j = argj.scalar_value (); if (argr.columns () != n) - error ("choldelete: matrix R must be square"); + err_square_matrix_required ("choldelete", "R"); if (j < 0 && j > n) error ("choldelete: index J out of range"); @@ -1144,7 +1144,7 @@ octave_idx_type j = argj.scalar_value (); if (argr.columns () != n) - error ("cholshift: R must be a square matrix"); + err_square_matrix_required ("cholshift", "R"); if (j < 0 || j > n+1 || i < 0 || i > n+1) error ("cholshift: index I or J is out of range");
--- a/libinterp/dldfcn/colamd.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/colamd.cc Tue Jan 19 14:09:56 2016 -0800 @@ -35,6 +35,7 @@ #include "ov.h" #include "defun-dld.h" +#include "errwarn.h" #include "pager.h" #include "ov-re-mat.h" @@ -579,7 +580,7 @@ } if (n_row != n_col) - error ("symamd: matrix S must be square"); + err_square_matrix_required ("symamd", "S"); // Allocate workspace for symamd OCTAVE_LOCAL_BUFFER (octave_idx_type, perm, n_col+1);
--- a/libinterp/dldfcn/symbfact.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/symbfact.cc Tue Jan 19 14:09:56 2016 -0800 @@ -194,7 +194,7 @@ } if (A->stype && A->nrow != A->ncol) - error ("symbfact: S must be a square matrix"); + err_square_matrix_required ("symbfact", "S"); OCTAVE_LOCAL_BUFFER (octave_idx_type, Parent, n); OCTAVE_LOCAL_BUFFER (octave_idx_type, Post, n);
--- a/libinterp/dldfcn/symrcm.cc Tue Jan 19 12:44:54 2016 -0800 +++ b/libinterp/dldfcn/symrcm.cc Tue Jan 19 14:09:56 2016 -0800 @@ -469,7 +469,7 @@ octave_idx_type nc = arg.columns (); if (nr != nc) - err_square_matrix_required ("symrcm"); + err_square_matrix_required ("symrcm", "S"); if (nr == 0 && nc == 0) return ovl (NDArray (dim_vector (1, 0)));