# HG changeset patch # User David Bateman # Date 1288035389 -7200 # Node ID 83da69c6e7bea15d4abeee10f6e74ea4285e7e5c # Parent f0e9befd6a1c90e858838470736e0e283aef4364 Sort values in discrete_pdf before calling lookup diff -r f0e9befd6a1c -r 83da69c6e7be scripts/ChangeLog --- a/scripts/ChangeLog Mon Oct 25 11:26:43 2010 +0200 +++ b/scripts/ChangeLog Mon Oct 25 21:36:29 2010 +0200 @@ -1,3 +1,8 @@ +2010-10-25 David Bateman + + * statistics/distributions/discrete_pdf.m: Sort values before calling + the lookup function. + 2010-10-25 Kai Habel * gl-render.cc (opengl_renderer::draw ): Ignore uimenu objects here. diff -r f0e9befd6a1c -r 83da69c6e7be scripts/statistics/distributions/discrete_pdf.m --- a/scripts/statistics/distributions/discrete_pdf.m Mon Oct 25 11:26:43 2010 +0200 +++ b/scripts/statistics/distributions/discrete_pdf.m Mon Oct 25 21:36:29 2010 +0200 @@ -53,7 +53,8 @@ k = find (!isnan (x)); if (any (k)) n = length (k); - pdf (k) = p (lookup (v, x(k), 'm')); + [vs, vi] = sort (v); + pdf (k) = p (vi(lookup (vs, x(k), 'm'))); endif endfunction