Mercurial > hg > octave-shane
changeset 6699:3f4ccca05612
[project @ 2007-06-12 20:48:02 by jwe]
author | jwe |
---|---|
date | Tue, 12 Jun 2007 20:48:03 +0000 |
parents | 6d366791e132 |
children | b55d109ffe7e |
files | liboctave/CMatrix.cc liboctave/ChangeLog liboctave/dMatrix.cc scripts/ChangeLog scripts/plot/fplot.m test/ChangeLog test/test_signal.m |
diffstat | 7 files changed, 42 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -2619,6 +2619,9 @@ ComplexMatrix m = *this; + if (numel () == 1) + return ComplexMatrix (1, 1, exp (m(0))); + octave_idx_type nc = columns (); // Preconditioning step 1: trace normalization to reduce dynamic
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,6 +1,7 @@ -2007-06-04 David Bateman <dbateman@free.fr> - - * file-ops.cc: Typo. +2007-06-12 John W. Eaton <jwe@octave.org> + + * dMatrix.cc (Matrix::expm): Special case for scalar arg. + * CMatrix.cc (ComplexMatrix::expm): Likewise. 2007-06-06 Michael Goffioul <michael.goffioul@swing.be> @@ -18,6 +19,8 @@ 2007-06-04 David Bateman <dbateman@free.fr> + * file-ops.cc: Typo. + * Sparse.cc (Sparse<T> Sparse<T>::reshape): If length of new dimensions is greater than 2, collapse to 2-D.
--- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -2252,6 +2252,9 @@ Matrix m = *this; + if (numel () == 1) + return Matrix (1, 1, exp (m(0))); + octave_idx_type nc = columns (); // Preconditioning step 1: trace normalization to reduce dynamic
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2007-06-12 Søren Hauberg <soren@hauberg.org> + + * plot/fplot.m: If function is inline, vectorize it. + 2007-06-10 David Bateman <dbateman@free.fr> * pkg/pkg.m (pkg:installed_packages): truncate start of package
--- a/scripts/plot/fplot.m +++ b/scripts/plot/fplot.m @@ -20,7 +20,7 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} fplot (@var{fn}, @var{limits}) ## @deftypefnx {Function File} {} fplot (@var{fn}, @var{limits}, @var{n}) -## Plots a function @var{fn}, within the defined limits. @var{fn} +## Plot a function @var{fn}, within the defined limits. @var{fn} ## an be either a string, a function handle or an inline function. ## The limits of the plot are given by @var{limits} of the form ## @code{[@var{xlo}, @var{xhi}]} or @code{[@var{xlo}, @var{xhi}, @@ -28,8 +28,8 @@ ## defaults to 100. ## ## @example -## fplot('cos',[0,2*pi]) -## fplot('[cos(x),sin(x)]',[0,2*pi]) +## fplot ("cos", [0, 2*pi]) +## fplot ("[cos(x), sin(x)]", [0, 2*pi]) ## @end example ## @end deftypefn @@ -44,12 +44,18 @@ x = linspace (limits(1), limits(2), n)'; - if (isa (fn, "inline function") || isa (fn, "function_handle")) + nam = fn; + if (strcmp (typeinfo (fn), "inline function")) + fn = vectorize (fn); y = fn (x); + nam = formula (fn); + elseif (isa (fn, "function_handle")) + y = fn (x); + nam = func2str (fn); elseif (all (isalnum (fn))) y = feval (fn, x); else - finl = inline (fn); + finl = vectorize (inline (fn)); y = finl (x); endif @@ -57,6 +63,6 @@ axis (limits); endif - plot (x, y, [";", fn, ";"]); + plot (x, y, [";", nam, ";"]); endfunction
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2007-06-06 John W. Eaton <jwe@octave.org> + + * test_signal.m: Rename internal assert function to xassert. + 2007-04-26 David Bateman <dbateman@free.fr> * test_for.m: Add tests for multi-dimensional matrices and cell
--- a/test/test_signal.m +++ b/test/test_signal.m @@ -123,7 +123,7 @@ %! assert(all( all( abs(s-answer) < 30*eps ) )); %% test/octave.test/signal/unwrap-1.m -%!function t = assert(a,b,tol) +%!function t = xassert(a,b,tol) %! if (nargin == 1) %! t = all(a(:)); %! else @@ -148,18 +148,18 @@ %! w = r - 2*pi*floor((r+pi)/(2*pi)); # wrapped into [-pi,pi] %! tol = 1e3*eps; # maximum expected deviation %! -%! t(++i) = assert(r, unwrap(w), tol); #unwrap single row -%! t(++i) = assert(r', unwrap(w'), tol); #unwrap single column -%! t(++i) = assert([r',r'], unwrap([w',w']), tol); #unwrap 2 columns -%! t(++i) = assert([r;r], unwrap([w;w],[],2), tol); #verify that dim works -%! t(++i) = assert(r+10, unwrap(10+w), tol); #verify that r(1)>pi works +%! t(++i) = xassert(r, unwrap(w), tol); #unwrap single row +%! t(++i) = xassert(r', unwrap(w'), tol); #unwrap single column +%! t(++i) = xassert([r',r'], unwrap([w',w']), tol); #unwrap 2 columns +%! t(++i) = xassert([r;r], unwrap([w;w],[],2), tol); #verify that dim works +%! t(++i) = xassert(r+10, unwrap(10+w), tol); #verify that r(1)>pi works %! -%! t(++i) = assert(w', unwrap(w',[],2)); #unwrap col by rows should not change it -%! t(++i) = assert(w, unwrap(w,[],1)); #unwrap row by cols should not change it -%! t(++i) = assert([w;w], unwrap([w;w])); #unwrap 2 rows by cols should not change them +%! t(++i) = xassert(w', unwrap(w',[],2)); #unwrap col by rows should not change it +%! t(++i) = xassert(w, unwrap(w,[],1)); #unwrap row by cols should not change it +%! t(++i) = xassert([w;w], unwrap([w;w])); #unwrap 2 rows by cols should not change them %! %! ## verify that setting tolerance too low will cause bad results. -%! t(++i) = assert(any(abs(r - unwrap(w,0.8)) > 100)); +%! t(++i) = xassert(any(abs(r - unwrap(w,0.8)) > 100)); %! %! assert(all(t));