# HG changeset patch # User jwe # Date 1197486864 0 # Node ID d8209a80e0932d2f52def3c04e69363a9467ca57 # Parent 28a9e3d3bf143c6510b3d4c5426f372f217323b6 [project @ 2007-12-12 19:14:23 by jwe] diff -r 28a9e3d3bf14 -r d8209a80e093 src/ChangeLog --- a/src/ChangeLog Wed Dec 12 18:44:35 2007 +0000 +++ b/src/ChangeLog Wed Dec 12 19:14:24 2007 +0000 @@ -1,3 +1,8 @@ +2007-12-12 David Bateman + + * DLD-FUNCTIONS/sparse.cc (Fsparse): Check for scalar arguments + for 2 argument version. + 2007-12-12 John W. Eaton * graphics.h.in (class axes) Add the layer property. diff -r 28a9e3d3bf14 -r d8209a80e093 src/DLD-FUNCTIONS/sparse.cc --- a/src/DLD-FUNCTIONS/sparse.cc Wed Dec 12 18:44:35 2007 +0000 +++ b/src/DLD-FUNCTIONS/sparse.cc Wed Dec 12 19:14:24 2007 +0000 @@ -66,10 +66,6 @@ Create a sparse matrix from the full matrix @var{a}.\n\ is forced back to a full matrix is resulting matrix is sparse\n\ \n\ -@deftypefnx {Loadable Function} {@var{s} =} sparse (@var{a}, 1)\n\ -Create a sparse matrix and convert it back to a full matrix.\n\ -is forced back to a full matrix is resulting matrix is sparse\n\ -\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ Create a sparse matrix given integer index vectors @var{i} and @var{j},\n\ a 1-by-@code{nnz} vector of real of complex values @var{sv}, overall\n\ @@ -184,19 +180,24 @@ octave_idx_type m = 1, n = 1; if (nargin == 2) { - m = args(0).int_value(); - n = args(1).int_value(); - if (error_state) return retval; + if (args(0).numel () == 1 && args(1).numel () == 1) + { + m = args(0).int_value(); + n = args(1).int_value(); + if (error_state) return retval; - if (use_complex) - retval = new octave_sparse_complex_matrix - (SparseComplexMatrix (m, n)); - else if (use_bool) - retval = new octave_sparse_bool_matrix - (SparseBoolMatrix (m, n)); + if (use_complex) + retval = new octave_sparse_complex_matrix + (SparseComplexMatrix (m, n)); + else if (use_bool) + retval = new octave_sparse_bool_matrix + (SparseBoolMatrix (m, n)); + else + retval = new octave_sparse_matrix + (SparseMatrix (m, n)); + } else - retval = new octave_sparse_matrix - (SparseMatrix (m, n)); + error ("sparse: expecting scalar values"); } else {