Mercurial > hg > octave-terminal
changeset 6987:deb175b6e4a1
[project @ 2007-10-09 18:39:15 by jwe]
author | jwe |
---|---|
date | Tue, 09 Oct 2007 18:39:16 +0000 |
parents | 4ad04ff722d7 |
children | c7484dcadd4d |
files | ChangeLog octMakefile.in run-octave.in scripts/ChangeLog scripts/general/repmat.m |
diffstat | 5 files changed, 65 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-10-09 John W. Eaton <jwe@octave.org> + + * gdbinit.in: Delete. + * octMakefile.in (DISTFILES): Remove it from the list. + (.gdbinit): Delete rule. + (maintainer-clean, distclean): No need to delete .gdbinit. + +2007-10-09 Kim Hansen <kimhanse@gmail.com> + + * run-octave.in: Use gdb with --args, not .gdbinit. + 2007-10-08 John W. Eaton <jwe@octave.org> * emacs/octave-hlp.el, emacs/octave-inf.el, emacs/octave-mod.el:
--- a/octMakefile.in +++ b/octMakefile.in @@ -35,7 +35,7 @@ README.MachTen README.kpathsea ROADMAP SENDING-PATCHES \ THANKS move-if-change octave-sh octave-bug.in \ octave-config.in mk-opts.pl mkinstalldirs \ - mkoctfile.in run-octave.in gdbinit.in ChangeLog ChangeLog.[0-9] + mkoctfile.in run-octave.in ChangeLog ChangeLog.[0-9] # Subdirectories in which to run `make all'. SUBDIRS = @DLFCN_DIR@ libcruft liboctave src scripts doc examples @@ -93,9 +93,6 @@ @$(do-subst-script-vals) chmod a+rx "$@" -.gdbinit: gdbinit.in Makeconf octMakefile - $(do-subst-script-vals) - check: $(MAKE) -C test $@ .PHONY: check @@ -155,7 +152,7 @@ rm -f octMakefile Makefile Makeconf Makefrag.f77 Makerules.f77 rm -f config.cache config.h config.log config.status rm -rf autom4te.cache - rm -f $(SHELL_SCRIPTS) .gdbinit + rm -f $(SHELL_SCRIPTS) rm -f unistd.h maintainer-clean::
--- a/run-octave.in +++ b/run-octave.in @@ -35,12 +35,7 @@ if [ $# -gt 0 ]; then if [ "x$1" = "x-g" ]; then - driver="gdb" - if [ `/bin/pwd` = "$builddir" ]; then - sed "s|^set args.*$|set args $args|" .gdbinit > .gdbinit-tmp - mv .gdbinit-tmp .gdbinit - fi - args="" + driver="gdb --args" shift elif [ "x$1" = "x-valgrind" ]; then driver="valgrind --tool=memcheck"
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2007-10-09: Kim Hansen <kimhanse@gmail.com> + + * general/repmat.m: Handle sparse input. Add tests. + 2007-10-09 John W. Eaton <jwe@octave.org> * audio/wavwrite.m: Accept arguments in compatible order.
--- a/scripts/general/repmat.m +++ b/scripts/general/repmat.m @@ -20,6 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} repmat (@var{A}, @var{m}, @var{n}) ## @deftypefnx {Function File} {} repmat (@var{A}, [@var{m} @var{n}]) +## @deftypefnx {Function File} {} repmat (@var{A}, [@var{m} @var{n} @var{p} ...]) ## Form a block matrix of size @var{m} by @var{n}, with a copy of matrix ## @var{A} as each element. If @var{n} is not specified, form an ## @var{m} by @var{m} block matrix. @@ -69,8 +70,13 @@ elseif (ndims (a) == 2 && length (idx) < 3) if (ischar (a)) x = char (kron (ones (idx), toascii (a))); - elseif (strcmp (class(a), "double")) - x = kron (ones (idx), a); + elseif (strcmp (class(a), "double")) + ## FIXME -- DISPATCH. + if (issparse (a)) + x = spkron (ones (idx), a); + else + x = kron (ones (idx), a); + endif else aidx = size(a); x = a (kron (ones (1, idx(1)), 1:aidx(1)), @@ -91,3 +97,42 @@ endif endfunction + +# Test various methods of providing size parameters +%!shared x +%! x = [1 2;3 4]; +%!assert(repmat(x, [1 1]), repmat(x, 1)); +%!assert(repmat(x, [3 3]), repmat(x, 3)); +%!assert(repmat(x, [1 1]), repmat(x, 1, 1)); +%!assert(repmat(x, [1 3]), repmat(x, 1, 3)); +%!assert(repmat(x, [3 1]), repmat(x, 3, 1)); +%!assert(repmat(x, [3 3]), repmat(x, 3, 3)); + +# Tests for numel==1 case: +%!shared x, r +%! x = [ 65 ]; +%! r = kron(ones(2,2), x); +%!assert(r, repmat(x, [2 2])); +%!assert(char(r), repmat(char(x), [2 2])); +%!assert(int8(r), repmat(int8(x), [2 2])); + +# Tests for ndims==2 case: +%!shared x, r +%! x = [ 65 66 67 ]; +%! r = kron(ones(2,2), x); +%!assert(r, repmat(x, [2 2])); +%!assert(char(r), repmat(char(x), [2 2])); +%!assert(int8(r), repmat(int8(x), [2 2])); + +# Tests for dim>2 case: +%!shared x, r +%! x = [ 65 66 67 ]; +%! r = kron(ones(2,2), x); +%! r(:,:,2) = r(:,:,1); +%!assert(r, repmat(x, [2 2 2])); +%!assert(char(r), repmat(char(x), [2 2 2])); +%!assert(int8(r), repmat(int8(x), [2 2 2])); + +# Test that sparsity is kept +%!assert(sparse(4,4), repmat(sparse(2,2),[2 2])); +