# HG changeset patch # User John W. Eaton # Date 1392306355 18000 # Node ID 35803170227e0abb93f8cd39683c2b5eb72c5767 # Parent 020c0fe578a7d044dc394d09ae49b60d3c84a502 * sparse.cc (Fsparse): Use get_dimensions to extract dimension args. diff -r 020c0fe578a7 -r 35803170227e libinterp/corefcn/sparse.cc --- a/libinterp/corefcn/sparse.cc Thu Feb 13 10:24:41 2014 +0100 +++ b/libinterp/corefcn/sparse.cc Thu Feb 13 10:45:55 2014 -0500 @@ -127,20 +127,15 @@ { octave_idx_type m = 0; octave_idx_type n = 0; - if (args(0).is_scalar_type () && args(1).is_scalar_type ()) - { - m = args(0).idx_type_value (); - n = args(1).idx_type_value (); - } - else - error ("sparse: dimensions M,N must be scalar"); + + get_dimensions (args(0), args(1), "sparse", m, n); if (! error_state) { if (m >= 0 && n >= 0) retval = SparseMatrix (m, n); else - error ("sparse: dimensions M,N must be positive or zero"); + error ("sparse: dimensions must be non-negative"); } } else if (nargin >= 3) @@ -171,14 +166,7 @@ if (nargin == 5) { - if (args(3).is_scalar_type () && args(4).is_scalar_type ()) - { - m = args(3).idx_type_value (); - n = args(4).idx_type_value (); - } - else - error ("sparse: expecting scalar dimensions"); - + get_dimensions (args(3), args(4), "sparse", m, n); if (! error_state && (m < 0 || n < 0)) error ("sparse: dimensions must be non-negative");