Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C0FBDAA6 for ; Tue, 11 Dec 2012 15:55:18 +0000 (UTC) Received: (qmail 58283 invoked by uid 500); 11 Dec 2012 15:55:17 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 58069 invoked by uid 500); 11 Dec 2012 15:55:17 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 58059 invoked by uid 99); 11 Dec 2012 15:55:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2012 15:55:16 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of phil.steitz@gmail.com designates 209.85.210.43 as permitted sender) Received: from [209.85.210.43] (HELO mail-da0-f43.google.com) (209.85.210.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2012 15:55:08 +0000 Received: by mail-da0-f43.google.com with SMTP id u36so1783906dak.30 for ; Tue, 11 Dec 2012 07:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=kLE+4iNs+XAmwfvnKlDFBh0tItcZSq0p4sIkk93MNDI=; b=T1w3G5PXxYi0ceMcD7mBmeJ/XQZsN5bb3G7KIVrXs7FTyJ/gC9ImEcDhs374MFVBZT 5yiA80RbVRWMZTV+sdJAU1TwdP2HL7EuoZWIkDBpsQZe/9xL60vZoJJhaMaMIwH24mA0 0mTu1jSlOFI+/KDrKu7FijVMMc58SqSWrn4UoupMcxfJq4grbpRmgJuWoU63BCPNKmDH Ox0YwZS05cyfrvA/f1NDH4eCHBDypFVZpSlwltOAIzYffLZEHUIBMcRcJfdwWCapEFuL pQ8SEPUY6uMQ+JRgKKh+KTFXJo+jFNF0X40Tni2mPwWFu96z6BEOq+yyvoRH1p0SuhEG bd8g== Received: by 10.68.230.66 with SMTP id sw2mr50006144pbc.119.1355241288575; Tue, 11 Dec 2012 07:54:48 -0800 (PST) Received: from [192.168.2.107] (ip72-208-109-243.ph.ph.cox.net. [72.208.109.243]) by mx.google.com with ESMTPS id d9sm14068018paw.33.2012.12.11.07.54.45 (version=SSLv3 cipher=OTHER); Tue, 11 Dec 2012 07:54:47 -0800 (PST) Message-ID: <50C75744.4000409@gmail.com> Date: Tue, 11 Dec 2012 07:54:44 -0800 From: Phil Steitz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Commons Developers List Subject: Re: svn commit: r1420000 - in /commons/proper/math/trunk/src: changes/changes.xml main/java/org/apache/commons/math3/random/EmpiricalDistribution.java test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java References: <20121211053608.A753223889E0@eris.apache.org> <20121211112633.GK20488@dusk.harfang.homelinux.org> In-Reply-To: <20121211112633.GK20488@dusk.harfang.homelinux.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 12/11/12 3:26 AM, Gilles Sadowski wrote: > Hi. > > On Tue, Dec 11, 2012 at 05:36:07AM -0000, psteitz@apache.org wrote: >> Author: psteitz >> Date: Tue Dec 11 05:36:06 2012 >> New Revision: 1420000 >> >> URL: http://svn.apache.org/viewvc?rev=1420000&view=rev >> Log: >> Added RealDistribution methods to EmpiricalDistribution. JIRA: MATH-672. >> >> Modified: >> commons/proper/math/trunk/src/changes/changes.xml >> commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java >> commons/proper/math/trunk/src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java >> >> Modified: commons/proper/math/trunk/src/changes/changes.xml >> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1420000&r1=1419999&r2=1420000&view=diff >> ============================================================================== >> --- commons/proper/math/trunk/src/changes/changes.xml (original) >> +++ commons/proper/math/trunk/src/changes/changes.xml Tue Dec 11 05:36:06 2012 >> @@ -77,6 +77,10 @@ This is a minor release: It combines bug >> 2. A few methods in the FastMath class are in fact slower that their >> counterpart in either Math or StrictMath (cf. MATH-740 and MATH-901). >> "> >> + >> + Added methods to EmpiricalDistribution to implement the RealDistribution >> + interface. >> + >> >> DBSCAN clustering algorithm (in package "o.a.c.m.stat.clustering"). >> >> >> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java >> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/random/EmpiricalDistribution.java?rev=1420000&r1=1419999&r2=1420000&view=diff >> ============================================================================== >> [...] >> + >> + /** >> + * Mass of bin i under the within-bin kernel of the bin. >> + * >> + * @param i index of the bin >> + * @return the difference in the within-bin kernel cdf between the >> + * upper and lower endpoints of bin i >> + */ >> + @SuppressWarnings("deprecation") >> + private double kB(int i) { >> + final double[] binBounds = getUpperBounds(); >> + final RealDistribution kernel = getKernel(binStats.get(i)); >> + return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) : >> + kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]); >> + } > Is there any advantage to suppressing the deprecation warnings? > There are many other instances in the code. It could be construed that it > points to the current state of affairs: deprecated code is only used where > we cannot do otherwise because of backward-compatibility constraints. I am fine getting rid of the suppressions. You are correct that the suppression is there only because there is no way to avoid the warning. > > > Unrelated but in that same file: > * The Javadoc mentions "RandomDataImpl" instead of "RandomDataGenerator". Thanks. Need to fix that. > * The Javadoc for constructor (line 191) > public EmpiricalDistribution(int binCount, > RandomDataGenerator randomData) > > mentions that "randomData [...] may be null, resulting in default JDK > generator". But that instead results in NPE. Hmm. I now see that introducing the super(generator) call to avoid deprecation warning broke the old contract. I will fix that. Good catch. > * The constructor (line 164) > public EmpiricalDistribution(int binCount, > RandomGenerator generator) > should call the one at line 191 instead of duplicating code. Yes. Will fix. > > > Regards, > Gilles > >> [...] > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org