# HG changeset patch # User jwe # Date 1163445623 0 # Node ID a46f14cdbecd78b0c9cb5002e677b53d2ec98f70 # Parent ab500899887673bac0ef6256058b4fb3e72887de [project @ 2006-11-13 19:20:23 by jwe] diff -r ab5008998876 -r a46f14cdbecd scripts/ChangeLog --- a/scripts/ChangeLog Mon Nov 13 18:49:52 2006 +0000 +++ b/scripts/ChangeLog Mon Nov 13 19:20:23 2006 +0000 @@ -1,3 +1,7 @@ +2006-11-13 John W. Eaton + + * plot/mesh.m: Use size_equal to compare dimensions. + 2006-11-13 Søren Hauberg * plot/mesh.m: Simplify. Set hidden3d for the plot. diff -r ab5008998876 -r a46f14cdbecd scripts/plot/mesh.m --- a/scripts/plot/mesh.m Mon Nov 13 18:49:52 2006 +0000 +++ b/scripts/plot/mesh.m Mon Nov 13 19:20:23 2006 +0000 @@ -50,8 +50,7 @@ error (msg); endif elseif (ismatrix (x) && ismatrix (y) && ismatrix (z)) - if (ndims (x) != ndims (y) || ndims (x) != ndims (z) - || size (x) != size (y) || size (x) != size (z)) + if (! (size_equal (x, y) && size_equal (x, z))) error ("mesh: x, y, and z must have same dimensions"); endif else diff -r ab5008998876 -r a46f14cdbecd src/ChangeLog --- a/src/ChangeLog Mon Nov 13 18:49:52 2006 +0000 +++ b/src/ChangeLog Mon Nov 13 19:20:23 2006 +0000 @@ -1,3 +1,7 @@ +2006-11-13 John W. Eaton + + * data.cc (Fsize_equal): New function. + 2006-11-13 Michael Goffioul * ov.cc (check_subsref_elements, Fsubsref, Fsubsasgn): diff -r ab5008998876 -r a46f14cdbecd src/data.cc --- a/src/data.cc Mon Nov 13 18:49:52 2006 +0000 +++ b/src/data.cc Mon Nov 13 19:20:23 2006 +0000 @@ -1081,10 +1081,36 @@ return retval; } +DEFUN (size_equal, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b})\n\ +Return true if the dimensions of @var{a} and @var{b} agree.\n\ +Trailing singleton dimensions are ignored.\n\ +@seealso{size, numel}\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 2) + { + dim_vector a_dims = args(0).dims (); + dim_vector b_dims = args(1).dims (); + + a_dims.chop_trailing_singletons (); + b_dims.chop_trailing_singletons (); + + retval = a_dims == b_dims; + } + else + print_usage (); + + return retval; +} + DEFUN (nnz, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {@var{scalar} =} nnz (@var{a})\n\ -returns number of non zero elements in @var{a}.\n\ +@deftypefn {Built-in Function} {@var{scalar} =} nnz (@var{a})\n\ +Returns the number of non zero elements in @var{a}.\n\ @seealso{sparse}\n\ @end deftypefn") { @@ -1100,7 +1126,7 @@ DEFUN (nzmax, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {@var{scalar} =} nzmax (@var{SM})\n\ +@deftypefn {Built-in Function} {@var{scalar} =} nzmax (@var{SM})\n\ Return the amount of storage allocated to the sparse matrix @var{SM}.\n\ Note that Octave tends to crop unused memory at the first oppurtunity\n\ for sparse objects. There are some cases of user created sparse objects\n\