Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F9D4B09E for ; Mon, 2 Jan 2012 07:20:41 +0000 (UTC) Received: (qmail 96389 invoked by uid 500); 2 Jan 2012 07:20:39 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 96038 invoked by uid 500); 2 Jan 2012 07:20:26 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 96022 invoked by uid 99); 2 Jan 2012 07:20:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2012 07:20:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jan 2012 07:20:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 20E012388A56 for ; Mon, 2 Jan 2012 07:19:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1226359 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform: FastCosineTransformer.java RealTransformer.java Date: Mon, 02 Jan 2012 07:19:58 -0000 To: commits@commons.apache.org From: celestin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120102071959.20E012388A56@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: celestin Date: Mon Jan 2 07:19:58 2012 New Revision: 1226359 URL: http://svn.apache.org/viewvc?rev=1226359&view=rev Log: Removed references to deprecated MathRuntimeException (MATH-677). Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1226359&r1=1226358&r2=1226359&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Mon Jan 2 07:19:58 2012 @@ -16,9 +16,11 @@ */ package org.apache.commons.math.transform; -import org.apache.commons.math.MathRuntimeException; import org.apache.commons.math.analysis.UnivariateFunction; import org.apache.commons.math.complex.Complex; +import org.apache.commons.math.exception.MathIllegalArgumentException; +import org.apache.commons.math.exception.NonMonotonicSequenceException; +import org.apache.commons.math.exception.NotStrictlyPositiveException; import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.util.FastMath; @@ -103,8 +105,7 @@ import org.apache.commons.math.util.Fast *

*

As of version 2.0 this no longer implements Serializable.

* - * @version $Id: FastCosineTransformer.java 1213585 2011-12-13 07:44:52Z - * celestin $ + * @version $Id$ * @since 1.2 */ public class FastCosineTransformer implements RealTransformer { @@ -154,8 +155,13 @@ public class FastCosineTransformer imple return new FastCosineTransformer(true); } - /** {@inheritDoc} */ - public double[] transform(double[] f) throws IllegalArgumentException { + /** + * {@inheritDoc} + * + * @throws MathIllegalArgumentException if the length of the data array is + * not a power of two plus one + */ + public double[] transform(double[] f) throws MathIllegalArgumentException { if (orthogonal) { final double s = FastMath.sqrt(2.0 / (f.length - 1)); @@ -164,26 +170,55 @@ public class FastCosineTransformer imple return fct(f); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * + * @throws NonMonotonicSequenceException if the lower bound is greater + * than, or equal to the upper bound + * @throws NotStrictlyPositiveException if the number of sample points is + * negative + * @throws MathIllegalArgumentException if the number of sample points is + * not a power of two plus one + */ public double[] transform(UnivariateFunction f, - double min, double max, int n) throws IllegalArgumentException { + double min, double max, int n) throws + NonMonotonicSequenceException, + NotStrictlyPositiveException, + MathIllegalArgumentException { final double[] data = FastFourierTransformer.sample(f, min, max, n); return transform(data); } - /** {@inheritDoc} */ - public double[] inverseTransform(double[] f) - throws IllegalArgumentException { + /** + * {@inheritDoc} + * + * @throws MathIllegalArgumentException if the length of the data array is + * not a power of two plus one + */ + public double[] inverseTransform(double[] f) throws + MathIllegalArgumentException { final double s2 = 2.0 / (f.length - 1); final double s1 = orthogonal ? FastMath.sqrt(s2) : s2; return FastFourierTransformer.scaleArray(fct(f), s1); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * + * @throws NonMonotonicSequenceException if the lower bound is greater + * than, or equal to the upper bound + * @throws NotStrictlyPositiveException if the number of sample points is + * negative + * @throws MathIllegalArgumentException if the number of sample points is + * not a power of two plus one + */ public double[] inverseTransform(UnivariateFunction f, - double min, double max, int n) throws IllegalArgumentException { + double min, double max, int n) throws + NonMonotonicSequenceException, + NotStrictlyPositiveException, + MathIllegalArgumentException { final double[] data = FastFourierTransformer.sample(f, min, max, n); return inverseTransform(data); @@ -194,18 +229,19 @@ public class FastCosineTransformer imple * * @param f the real data array to be transformed * @return the real transformed array - * @throws IllegalArgumentException if any parameters are invalid + * @throws MathIllegalArgumentException if the length of the data array is + * not a power of two plus one */ protected double[] fct(double[] f) - throws IllegalArgumentException { + throws MathIllegalArgumentException { final double[] transformed = new double[f.length]; final int n = f.length - 1; if (!FastFourierTransformer.isPowerOf2(n)) { - throw MathRuntimeException.createIllegalArgumentException( - LocalizedFormats.NOT_POWER_OF_TWO_PLUS_ONE, - f.length); + throw new MathIllegalArgumentException( + LocalizedFormats.NOT_POWER_OF_TWO_PLUS_ONE, + Integer.valueOf(f.length)); } if (n == 1) { // trivial case transformed[0] = 0.5 * (f[0] + f[1]); Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java?rev=1226359&r1=1226358&r2=1226359&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java Mon Jan 2 07:19:58 2012 @@ -38,10 +38,8 @@ public interface RealTransformer { * * @param f the real data array to be transformed (signal) * @return the real transformed array (spectrum) - * @throws IllegalArgumentException if any parameters are invalid */ - double[] transform(double[] f) - throws IllegalArgumentException; + double[] transform(double[] f); /** * Returns the forward transform of the specified real function, sampled on @@ -52,20 +50,16 @@ public interface RealTransformer { * @param max the (exclusive) upper bound for the interval * @param n the number of sample points * @return the real transformed array - * @throws IllegalArgumentException if any parameters are invalid */ - double[] transform(UnivariateFunction f, double min, double max, int n) - throws IllegalArgumentException; + double[] transform(UnivariateFunction f, double min, double max, int n); /** * Returns the inverse transform of the specified real data set. * * @param f the real data array to be inversely transformed * @return the real inversely transformed array - * @throws IllegalArgumentException if any parameters are invalid */ - double[] inverseTransform(double[] f) - throws IllegalArgumentException; + double[] inverseTransform(double[] f); /** * Returns the inverse transform of the specified real function, sampled @@ -76,9 +70,6 @@ public interface RealTransformer { * @param max the (exclusive) upper bound for the interval * @param n the number of sample points * @return the real inversely transformed array - * @throws IllegalArgumentException if any parameters are invalid */ - double[] inverseTransform(UnivariateFunction f, double min, double max, int n) - throws IllegalArgumentException; - + double[] inverseTransform(UnivariateFunction f, double min, double max, int n); }