* [gentoo-commits] gentoo-x86 commit in sci-mathematics/octave/files: octave-3.2.4-normal-marker-size.patch octave-3.2.4-filter-empty-vector.patch octave-3.2.4-addpath.patch octave-3.2.4-imshow.patch octave-3.2.4-no-helvetica.patch octave-3.2.4-interp2.patch
@ 2010-10-03 23:45 Sebastien Fabbro (bicatali)
0 siblings, 0 replies; only message in thread
From: Sebastien Fabbro (bicatali) @ 2010-10-03 23:45 UTC (permalink / raw
To: gentoo-commits
bicatali 10/10/03 23:45:04
Added: octave-3.2.4-normal-marker-size.patch
octave-3.2.4-filter-empty-vector.patch
octave-3.2.4-addpath.patch
octave-3.2.4-imshow.patch
octave-3.2.4-no-helvetica.patch
octave-3.2.4-interp2.patch
Log:
Added a few patches from upstream and debian. Should pass tests now.
(Portage version: 2.2_rc88/cvs/Linux x86_64)
Revision Changes Path
1.1 sci-mathematics/octave/files/octave-3.2.4-normal-marker-size.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-normal-marker-size.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-normal-marker-size.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-normal-marker-size.patch
===================================================================
Revert the symbol markers in plots to their normal size. Thanks to
Francesco Potorti for the patch.
-- Rafael Laboissiere <rafael@debian.org> Tue, 24 Feb 2009 11:40:01 +0100
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -689,7 +689,7 @@
usingclause{data_idx} = sprintf ("record=%d", numel (obj.xdata));
if (isfield (obj, "markersize"))
- mdat = obj.markersize / 3;
+ mdat = obj.markersize / 6;
endif
if (isfield (obj, "edgecolor"))
@@ -1471,7 +1471,7 @@
endif
if (isfield (obj, "markersize"))
- fprintf (plot_stream, " pointsize %f", obj.markersize / 3);
+ fprintf (plot_stream, " pointsize %f", obj.markersize / 6);
found_style = true;
endif
else
1.1 sci-mathematics/octave/files/octave-3.2.4-filter-empty-vector.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-filter-empty-vector.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-filter-empty-vector.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-filter-empty-vector.patch
===================================================================
From: "John W. Eaton" <jwe@octave.org>
Subject: Don't crash on filtering an empty vector
Origin: upstream, http://hg.savannah.gnu.org/hgweb/octave/rev/a277ba5da4dc
Bug-Debian: http://bugs.debian.org/567975
--- a/src/DLD-FUNCTIONS/filter.cc
+++ b/src/DLD-FUNCTIONS/filter.cc
@@ -117,6 +117,9 @@
}
}
+ if (x_len == 0)
+ return x;
+
if (norm != static_cast<T>(1.0))
{
a = a / norm;
1.1 sci-mathematics/octave/files/octave-3.2.4-addpath.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-addpath.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-addpath.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-addpath.patch
===================================================================
From: "Thomas Weber" <tweber@debian.org>
Subject: Don't crash on calling addpath('./')
Description: Octave 3.2 crashes when calling something like
echo "addpath('./'); addpath('./')" | octave
This patch originates from a larger patch from upstreams's development version.
Origin: partly upstream, http://hg.savannah.gnu.org/hgweb/octave/rev/4acae5e46738
Bug-Debian: http://bugs.debian.org/592517
Applied-Upstream: http://hg.savannah.gnu.org/hgweb/octave/rev/4acae5e46738
--- a/src/load-path.cc
+++ b/src/load-path.cc
@@ -653,8 +653,6 @@
if (i != dir_info_list.end ())
move (i, false);
- else
- panic_impossible ();
}
void
1.1 sci-mathematics/octave/files/octave-3.2.4-imshow.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-imshow.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-imshow.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-imshow.patch
===================================================================
From: Rik <octave@nomad.inbox5.com>
Subject: Scale image point color according to colormap.
Origin: upstream, http://hg.savannah.gnu.org/hgweb/octave/rev/bc4eb29e0cb4
Bug: http://savannah.gnu.org/bugs/?29926
Bug-Debian: http://bugs.debian.org/581998
--- a/scripts/image/imshow.m
+++ b/scripts/image/imshow.m
@@ -64,7 +64,6 @@
## Get the image.
if (ischar (im))
- ## Eventually, this should be imread.
[im, map] = imread (im);
indexed = true;
colormap (map);
@@ -163,7 +162,8 @@
if (true_color || indexed)
tmp = image ([], [], im);
else
- tmp = image (round ((rows (colormap ()) - 1) * im));
+ tmp = image (im);
+ set (tmp, "cdatamapping", "scaled");
endif
set (gca (), "visible", "off");
axis ("image");
1.1 sci-mathematics/octave/files/octave-3.2.4-no-helvetica.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-no-helvetica.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-no-helvetica.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-no-helvetica.patch
===================================================================
Don't set Helvetica as default font, it's not available as TrueType
font. Fixes Bug#477688.
-- Rafael Laboissiere <rafael@debian.org> Sat, 19 Jul 2008 10:27:26 +0200
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -1751,7 +1751,7 @@
function [f, s, fnt, it, bld] = get_fontname_and_size (t)
if (isempty (t.fontname))
- fnt = "Helvetica";
+ fnt = "*";
else
fnt = t.fontname;
endif
@@ -1789,7 +1789,7 @@
if (strcmp (fld, "string"))
[f, s, fnt, it, bld] = get_fontname_and_size (obj);
else
- f = "Helvetica";
+ f = "*";
s = 10;
fnt = f;
it = false;
1.1 sci-mathematics/octave/files/octave-3.2.4-interp2.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-interp2.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-mathematics/octave/files/octave-3.2.4-interp2.patch?rev=1.1&content-type=text/plain
Index: octave-3.2.4-interp2.patch
===================================================================
From: various upstream authors authors
Description: Implement bicubic interpolation correctly
This patch fixes a bug triggered by octave-image's test suite.
Origin: upstream, http://hg.savannah.gnu.org/hgweb/octave/file/62bb59f927b1/scripts/general/interp2.m
Bug-Debian: http://bugs.debian.org/582276
--- a/scripts/general/interp2.m
+++ b/scripts/general/interp2.m
@@ -57,7 +57,7 @@
## @item 'linear'
## Linear interpolation from nearest neighbors.
## @item 'pchip'
-## Piece-wise cubic hermite interpolating polynomial (not implemented yet).
+## Piece-wise cubic hermite interpolating polynomial.
## @item 'cubic'
## Cubic interpolation from four nearest neighbors.
## @item 'spline'
@@ -218,18 +218,21 @@
c = Z(2:zr, 1:(zc - 1)) - a;
d = Z(2:zr, 2:zc) - a - b - c;
- idx = sub2ind (size (a), yidx, xidx);
-
## scale XI, YI values to a 1-spaced grid
- Xsc = (XI - X(xidx)) ./ (X(xidx + 1) - X(xidx));
- Ysc = (YI - Y(yidx)) ./ (Y(yidx + 1) - Y(yidx));
+ Xsc = (XI - X(xidx)) ./ (diff (X)(xidx));
+ Ysc = (YI - Y(yidx)) ./ (diff (Y)(yidx));
+
+ ## Get 2D index.
+ idx = sub2ind (size (a), yidx, xidx);
+ ## We can dispose of the 1D indices at this point to save memory.
+ clear xidx yidx
## apply plane equation
ZI = a(idx) + b(idx).*Xsc + c(idx).*Ysc + d(idx).*Xsc.*Ysc;
elseif (strcmp (method, "nearest"))
- ii = (XI - X(xidx) > X(xidx + 1) - XI);
- jj = (YI - Y(yidx) > Y(yidx + 1) - YI);
+ ii = (XI - X(xidx) >= X(xidx + 1) - XI);
+ jj = (YI - Y(yidx) >= Y(yidx + 1) - YI);
idx = sub2ind (size (Z), yidx+jj, xidx+ii);
ZI = Z(idx);
@@ -339,11 +342,64 @@
## FIXME bicubic/__splinen__ don't handle arbitrary XI, YI
if (strcmp (method, "cubic"))
- ZI = bicubic (X, Y, Z, XI(1,:), YI(:,1), extrapval);
+ if (isgriddata (XI) && isgriddata (YI'))
+ ZI = bicubic (X, Y, Z, XI (1, :), YI (:, 1), extrapval);
+ elseif (isgriddata (X) && isgriddata (Y'))
+ ## Allocate output
+ ZI = zeros (size (X));
+
+ ## Find inliers
+ inside = !(XI < X (1) | XI > X (end) | YI < Y (1) | YI > Y (end));
+
+ ## Scale XI and YI to match indices of Z
+ XI = (columns (Z) - 1) * (XI - X (1)) / (X (end) - X (1)) + 1;
+ YI = (rows (Z) - 1) * (YI - Y (1)) / (Y (end) - Y (1)) + 1;
+
+ ## Start the real work
+ K = floor (XI);
+ L = floor (YI);
+
+ ## Coefficients
+ AY1 = bc ((YI - L + 1));
+ AX1 = bc ((XI - K + 1));
+ AY0 = bc ((YI - L + 0));
+ AX0 = bc ((XI - K + 0));
+ AY_1 = bc ((YI - L - 1));
+ AX_1 = bc ((XI - K - 1));
+ AY_2 = bc ((YI - L - 2));
+ AX_2 = bc ((XI - K - 2));
+
+ ## Perform interpolation
+ sz = size(Z);
+ ZI = AY_2 .* AX_2 .* Z (sym_sub2ind (sz, L+2, K+2)) ...
+ + AY_2 .* AX_1 .* Z (sym_sub2ind (sz, L+2, K+1)) ...
+ + AY_2 .* AX0 .* Z (sym_sub2ind (sz, L+2, K)) ...
+ + AY_2 .* AX1 .* Z (sym_sub2ind (sz, L+2, K-1)) ...
+ + AY_1 .* AX_2 .* Z (sym_sub2ind (sz, L+1, K+2)) ...
+ + AY_1 .* AX_1 .* Z (sym_sub2ind (sz, L+1, K+1)) ...
+ + AY_1 .* AX0 .* Z (sym_sub2ind (sz, L+1, K)) ...
+ + AY_1 .* AX1 .* Z (sym_sub2ind (sz, L+1, K-1)) ...
+ + AY0 .* AX_2 .* Z (sym_sub2ind (sz, L, K+2)) ...
+ + AY0 .* AX_1 .* Z (sym_sub2ind (sz, L, K+1)) ...
+ + AY0 .* AX0 .* Z (sym_sub2ind (sz, L, K)) ...
+ + AY0 .* AX1 .* Z (sym_sub2ind (sz, L, K-1)) ...
+ + AY1 .* AX_2 .* Z (sym_sub2ind (sz, L-1, K+2)) ...
+ + AY1 .* AX_1 .* Z (sym_sub2ind (sz, L-1, K+1)) ...
+ + AY1 .* AX0 .* Z (sym_sub2ind (sz, L-1, K)) ...
+ + AY1 .* AX1 .* Z (sym_sub2ind (sz, L-1, K-1));
+ ZI (!inside) = extrapval;
+
+ else
+ error ("interp2: input data must have `meshgrid' format");
+ endif
elseif (strcmp (method, "spline"))
- ZI = __splinen__ ({Y(:,1).', X(1,:)}, Z, {YI(:,1), XI(1,:)}, extrapval,
+ if (isgriddata (XI) && isgriddata (YI'))
+ ZI = __splinen__ ({Y(:,1).', X(1,:)}, Z, {YI(:,1), XI(1,:)}, extrapval,
"spline");
+ else
+ error ("interp2: input data must have `meshgrid' format");
+ endif
else
error ("interpolation method not recognized");
endif
@@ -351,6 +407,38 @@
endif
endfunction
+function b = isgriddata (X)
+ d1 = diff (X, 1, 1);
+ d2 = diff (X, 1, 2);
+ b = all (d1 (:) == 0) & all (d2 (:) == d2 (1));
+endfunction
+
+## Compute the bicubic interpolation coefficients
+function o = bc(x)
+ x = abs(x);
+ o = zeros(size(x));
+ idx1 = (x < 1);
+ idx2 = !idx1 & (x < 2);
+ o(idx1) = 1 - 2.*x(idx1).^2 + x(idx1).^3;
+ o(idx2) = 4 - 8.*x(idx2) + 5.*x(idx2).^2 - x(idx2).^3;
+endfunction
+
+## This version of sub2ind behaves as if the data was symmetrically padded
+function ind = sym_sub2ind(sz, Y, X)
+ Y (Y < 1) = 1 - Y (Y < 1);
+ while (any (Y (:) > 2 * sz (1)))
+ Y (Y > 2 * sz (1)) = round (Y (Y > 2 * sz (1)) / 2);
+ endwhile
+ Y (Y > sz (1)) = 1 + 2 * sz (1) - Y (Y > sz (1));
+ X (X < 1) = 1 - X (X < 1);
+ while (any (X (:) > 2 * sz (2)))
+ X (X > 2 * sz (2)) = round (X (X > 2 * sz (2)) / 2);
+ endwhile
+ X (X > sz (2)) = 1 + 2 * sz (2) - X (X > sz (2));
+ ind = sub2ind(sz, Y, X);
+endfunction
+
+
%!demo
%! A=[13,-1,12;5,4,3;1,6,2];
%! x=[0,1,4]; y=[10,11,12];
@@ -493,3 +581,7 @@
%! assert(interp2(x,y,A,x,y,'linear'), A);
%! assert(interp2(x,y,A,x,y,'nearest'), A);
+%!test % for Matlab-compatible rounding for 'nearest'
+%! X = meshgrid (1:4);
+%! assert (interp2 (X, 2.5, 2.5, 'nearest'), 3);
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-03 23:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-03 23:45 [gentoo-commits] gentoo-x86 commit in sci-mathematics/octave/files: octave-3.2.4-normal-marker-size.patch octave-3.2.4-filter-empty-vector.patch octave-3.2.4-addpath.patch octave-3.2.4-imshow.patch octave-3.2.4-no-helvetica.patch octave-3.2.4-interp2.patch Sebastien Fabbro (bicatali)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox