# HG changeset patch # User John W. Eaton # Date 1287071584 14400 # Node ID ffb2f1ef209743fc0ab88ba67452d05e82ddbd0c # Parent 04c3aacbbc46ba38bcae330b0b1a7e113d151ac0 make issparse, sparse, and spalloc built-in functions diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-10-14 John W. Eaton + + * set/unique.m: Remove check for issparse existence since it is + now a built-in function. + 2010-10-14 Ben Abbott * strings/strjust.m: Clarify that justification applies to spaces and diff --git a/scripts/set/unique.m b/scripts/set/unique.m --- a/scripts/set/unique.m +++ b/scripts/set/unique.m @@ -82,20 +82,14 @@ ## fast as for full matrices, operate on the nonzero elements of the ## sparse array as long as we are not operating on rows. - ## FIXME -- unique is called when PKG_ADD files are parsed, but - ## issparse is not yet available because it is coming from a .oct - ## file?!? - - if (exist ("issparse")) - if (issparse (x) && ! optrows && nargout <= 1) - if (nnz (x) < numel (x)) - y = unique ([0; (full (nonzeros (x)))], varargin{:}); - else - ## Corner case where sparse matrix is actually full - y = unique (full (x), varargin{:}); - endif - return; + if (issparse (x) && ! optrows && nargout <= 1) + if (nnz (x) < numel (x)) + y = unique ([0; (full (nonzeros (x)))], varargin{:}); + else + ## Corner case where sparse matrix is actually full + y = unique (full (x), varargin{:}); endif + return; endif if (optrows) diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-10-14 John W. Eaton + + * sparse.cc: Rename from DLD-FUNCTIONS/sparse.cc. Include + defun.h, not defun-dld.h. + (Fissparse, Fsparse, Fspalloc): Use DEFUN, not DEFUN_DLD. + * Makefile.am (DIST_SRC): Add sparse.cc to the list. + * DLD-FUNCTIONS/module-files: Remove sparse.cc from the list of files. + 2010-10-09 Ben Abbott * gl-render.cc: Treat images with scalar unique(x/ydata) like Matlab. diff --git a/src/DLD-FUNCTIONS/module-files b/src/DLD-FUNCTIONS/module-files --- a/src/DLD-FUNCTIONS/module-files +++ b/src/DLD-FUNCTIONS/module-files @@ -63,7 +63,6 @@ rcond.cc regexp.cc schur.cc -sparse.cc spparms.cc sqrtm.cc strfind.cc diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -434,6 +434,7 @@ procstream.cc \ sighandlers.cc \ siglist.c \ + sparse.cc \ sparse-xdiv.cc \ sparse-xpow.cc \ strfns.cc \ diff --git a/src/DLD-FUNCTIONS/sparse.cc b/src/sparse.cc rename from src/DLD-FUNCTIONS/sparse.cc rename to src/sparse.cc --- a/src/DLD-FUNCTIONS/sparse.cc +++ b/src/sparse.cc @@ -32,7 +32,7 @@ #include "variables.h" #include "utils.h" #include "pager.h" -#include "defun-dld.h" +#include "defun.h" #include "gripes.h" #include "quit.h" #include "unwind-prot.h" @@ -41,7 +41,7 @@ #include "ov-cx-sparse.h" #include "ov-bool-sparse.h" -DEFUN_DLD (issparse, args, , +DEFUN (issparse, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} issparse (@var{expr})\n\ Return 1 if the value of the expression @var{expr} is a sparse matrix.\n\ @@ -56,7 +56,7 @@ return octave_value (args(0).is_sparse_type ()); } -DEFUN_DLD (sparse, args, , +DEFUN (sparse, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{s} =} sparse (@var{a})\n\ @deftypefnx {Loadable Function} {@var{s} =} sparse (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ @@ -205,7 +205,7 @@ return retval; } -DEFUN_DLD (spalloc, args, , +DEFUN (spalloc, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{s} =} spalloc (@var{m}, @var{n}, @var{nz})\n\ Creates a @var{m}-by-@var{n} sparse matrix with pre-allocated space for at\n\