# HG changeset patch # User jwe # Date 1191955156 0 # Node ID deb175b6e4a1cd8a7a1a167816f720ba34d55a92 # Parent 4ad04ff722d76956e71fabf237e417ba6edbe795 [project @ 2007-10-09 18:39:15 by jwe] diff -r 4ad04ff722d7 -r deb175b6e4a1 ChangeLog --- a/ChangeLog Tue Oct 09 17:43:00 2007 +0000 +++ b/ChangeLog Tue Oct 09 18:39:16 2007 +0000 @@ -1,3 +1,14 @@ +2007-10-09 John W. Eaton + + * 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 + + * run-octave.in: Use gdb with --args, not .gdbinit. + 2007-10-08 John W. Eaton * emacs/octave-hlp.el, emacs/octave-inf.el, emacs/octave-mod.el: diff -r 4ad04ff722d7 -r deb175b6e4a1 octMakefile.in --- a/octMakefile.in Tue Oct 09 17:43:00 2007 +0000 +++ b/octMakefile.in Tue Oct 09 18:39:16 2007 +0000 @@ -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:: diff -r 4ad04ff722d7 -r deb175b6e4a1 run-octave.in --- a/run-octave.in Tue Oct 09 17:43:00 2007 +0000 +++ b/run-octave.in Tue Oct 09 18:39:16 2007 +0000 @@ -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" diff -r 4ad04ff722d7 -r deb175b6e4a1 scripts/ChangeLog --- a/scripts/ChangeLog Tue Oct 09 17:43:00 2007 +0000 +++ b/scripts/ChangeLog Tue Oct 09 18:39:16 2007 +0000 @@ -1,3 +1,7 @@ +2007-10-09: Kim Hansen + + * general/repmat.m: Handle sparse input. Add tests. + 2007-10-09 John W. Eaton * audio/wavwrite.m: Accept arguments in compatible order. diff -r 4ad04ff722d7 -r deb175b6e4a1 scripts/general/repmat.m --- a/scripts/general/repmat.m Tue Oct 09 17:43:00 2007 +0000 +++ b/scripts/general/repmat.m Tue Oct 09 18:39:16 2007 +0000 @@ -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])); +