Mercurial > hg > octave-terminal
changeset 10540:952d4df5b686
Eliminate NaN*ones and Inf*ones constructs and just use Nan() and Inf()
author | Rik <code@nomad.inbox5.com> |
---|---|
date | Thu, 22 Apr 2010 14:03:47 -0700 |
parents | 8db807a0eb78 |
children | e9d1a974a517 |
files | scripts/ChangeLog scripts/general/rat.m scripts/geometry/triplot.m scripts/optimization/qp.m scripts/optimization/sqp.m scripts/sparse/gplot.m scripts/statistics/base/ranks.m scripts/statistics/base/run_count.m scripts/strings/base2dec.m |
diffstat | 9 files changed, 20 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,10 @@ +2010-04-22 Rik <octave@nomad.inbox5.com> + + * general/rat.m, sparse/gplot.m, strings/base2dec.m, geometry/triplot.m + optimization/sqp.m, optimization/qp.m, statistics/base/run_count.m, + statistics/base/ranks.m: Eliminate NaN*ones and Inf*ones constructs + and just use Nan() and Inf() + 2010-04-19 Ben Abbott <bpabbott@mac.com> * /plot/colorbar.m: Allow 'peer' option to be specified.
--- a/scripts/general/rat.m +++ b/scripts/general/rat.m @@ -71,7 +71,7 @@ idx = find(abs (y-n./d) >= tol); if (isempty(idx)) if (isempty (steps)) - steps = NaN .* ones (nsz, 1); + steps = NaN (nsz, 1); endif break; endif @@ -82,7 +82,7 @@ step = round(flip); if (nargout < 2) - tsteps = NaN .* ones (nsz, 1); + tsteps = NaN (nsz, 1); tsteps (idx) = step; steps = [steps, tsteps]; endif
--- a/scripts/geometry/triplot.m +++ b/scripts/geometry/triplot.m @@ -37,11 +37,11 @@ idx = tri(:, [1, 2, 3, 1]).'; nt = size (tri, 1); if (nargout > 0) - h = plot ([x(idx); NaN*ones(1, nt)](:), - [y(idx); NaN*ones(1, nt)](:), varargin{:}); + h = plot ([x(idx); NaN(1, nt)](:), + [y(idx); NaN(1, nt)](:), varargin{:}); else - plot ([x(idx); NaN*ones(1, nt)](:), - [y(idx); NaN*ones(1, nt)](:), varargin{:}); + plot ([x(idx); NaN(1, nt)](:), + [y(idx); NaN(1, nt)](:), varargin{:}); endif endfunction
--- a/scripts/optimization/qp.m +++ b/scripts/optimization/qp.m @@ -349,7 +349,7 @@ btmp = bin; endif ctmp = [zeros(n-n_eq, 1); ones(n_in, 1)]; - lb = [-Inf*ones(n-n_eq,1); zeros(n_in,1)]; + lb = [-Inf(n-n_eq,1); zeros(n_in,1)]; ub = []; ctype = repmat ("L", n_in, 1); [P, dummy, status] = glpk (ctmp, Atmp, btmp, lb, ub, ctype);
--- a/scripts/optimization/sqp.m +++ b/scripts/optimization/sqp.m @@ -412,7 +412,7 @@ C(idx,:) = []; [p, obj_qp, INFO, lambda] = qp (x, B, c, F, g, [], [], d, C, - Inf * ones (size (d))); + Inf (size (d))); info = INFO.info;
--- a/scripts/sparse/gplot.m +++ b/scripts/sparse/gplot.m @@ -43,8 +43,8 @@ endif [i, j] = find (a); - xcoord = [xy(i,1), xy(j,1), NaN * ones(length(i),1)]'(:); - ycoord = [xy(i,2), xy(j,2), NaN * ones(length(i),1)]'(:); + xcoord = [xy(i,1), xy(j,1), NaN (length(i),1) ]'(:); + ycoord = [xy(i,2), xy(j,2), NaN (length(i),1) ]'(:); if (nargout == 0) plot (xcoord, ycoord, line_style);
--- a/scripts/statistics/base/ranks.m +++ b/scripts/statistics/base/ranks.m @@ -67,7 +67,7 @@ x = permute (x, perm); endif sz = size (x); - infvec = -Inf * ones ([1, sz(2 : end)]); + infvec = -Inf ([1, sz(2 : end)]); [xs, xi] = sort (x); eq_el = find (diff ([xs; infvec]) == 0); if (isempty (eq_el))
--- a/scripts/statistics/base/run_count.m +++ b/scripts/statistics/base/run_count.m @@ -72,7 +72,7 @@ endfor c = sz(1); tmp = zeros ([c + 1, sz(2 : end)]); - infvec = Inf * ones ([1, sz(2 : end)]); + infvec = Inf ([1, sz(2 : end)]); ind = find (diff ([infvec; x; -infvec]) < 0); tmp(ind(2:end) - 1) = diff(ind);
--- a/scripts/strings/base2dec.m +++ b/scripts/strings/base2dec.m @@ -75,7 +75,7 @@ ## Lookup value of symbols in symbol table, with invalid symbols ## evaluating to NaN and space evaluating to 0. - table = NaN * ones (256, 1); + table = NaN (256, 1); table (toascii (symbols (1 : base))) = 0 : base-1; table (toascii (" ")) = 0; d = reshape (table (toascii (d)), size (d));