Mercurial > hg > octave-thorsten
changeset 11097:ffb2f1ef2097
make issparse, sparse, and spalloc built-in functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 14 Oct 2010 11:53:04 -0400 |
parents | 04c3aacbbc46 |
children | dcde7c5a1d29 |
files | scripts/ChangeLog scripts/set/unique.m src/ChangeLog src/DLD-FUNCTIONS/module-files src/DLD-FUNCTIONS/sparse.cc src/Makefile.am src/sparse.cc |
diffstat | 6 files changed, 25 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2010-10-14 John W. Eaton <jwe@octave.org> + + * set/unique.m: Remove check for issparse existence since it is + now a built-in function. + 2010-10-14 Ben Abbott <bpabbott@mac.com> * strings/strjust.m: Clarify that justification applies to spaces and
--- 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)
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-10-14 John W. Eaton <jwe@octave.org> + + * 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 <bpabbott@mac.com> * gl-render.cc: Treat images with scalar unique(x/ydata) like Matlab.
--- 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
--- 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 \
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\