Path: news.mathworks.com!not-for-mail
From: Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: randsample bug?
Date: Mon, 06 Jul 2009 12:04:03 -0400
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <h2t79j$1s$2@fred.mathworks.com>
References: <zJSdnVIvjZGfYdHXnZ2dnUVZ_tidnZ2d@giganews.com> <h2jbh7$47a$1@fred.mathworks.com> <KYqdnW5lYOlb7dPXnZ2dnUVZ_vZi4p2d@giganews.com>
NNTP-Posting-Host: perkinsp.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1246896243 60 172.31.57.88 (6 Jul 2009 16:04:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 6 Jul 2009 16:04:03 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
In-Reply-To: <KYqdnW5lYOlb7dPXnZ2dnUVZ_vZi4p2d@giganews.com>
Xref: news.mathworks.com comp.soft-sys.matlab:553141


MZ wrote:

> > Peter, my weighting function is fairly long.  2001 elements.  I can send 
> > it to you (as a .mat file?) if you give me an email address.

Yes, I would be interested to see that, to confirm my suspicions.  A mat file would be best, if possible.  My address is as in the msg header, with obvious modification.

> > I'm normalizing the cumsum(p) element.  It shouldn't NEED normalization 
> > since p was normalized.  But for some reason it does.  Now it works 
> > every time.
> > 
> > Also, if it helps, I'm using single not double precision for everything.

Well, that's accumulated round-off error.  Single precision makes it a whole lot easier to run into.  What I'm confused about is that you said

> > In fact, when I ask it if max(cumsum(p))>1, it returns true.

and that would not seem to cause the problem you saw (perhaps you meant "<"?).  In any case, thanks for pointing this out, and thanks in advance for sending those weights.

- Peter Perkins
  The MathWorks, Inc.