Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 30480 invoked from network); 22 Dec 2005 21:19:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Dec 2005 21:19:05 -0000 Received: (qmail 67488 invoked by uid 500); 22 Dec 2005 21:18:47 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 67192 invoked by uid 500); 22 Dec 2005 21:18:46 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 67075 invoked by uid 500); 22 Dec 2005 21:18:45 -0000 Received: (qmail 66882 invoked by uid 99); 22 Dec 2005 21:18:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2005 13:18:44 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 22 Dec 2005 13:18:40 -0800 Received: (qmail 29846 invoked by uid 65534); 22 Dec 2005 21:18:19 -0000 Message-ID: <20051222211819.29845.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r358631 [1/3] - in /jakarta/commons/proper/math/trunk: ./ src/conf/ src/java/org/apache/commons/math/ src/java/org/apache/commons/math/analysis/ src/java/org/apache/commons/math/complex/ src/java/org/apache/commons/math/distribution/ src/ja... Date: Thu, 22 Dec 2005 21:17:07 -0000 To: commons-cvs@jakarta.apache.org From: psteitz@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: psteitz Date: Thu Dec 22 13:16:32 2005 New Revision: 358631 URL: http://svn.apache.org/viewcvs?rev=358631&view=rev Log: Merged (final) src changes from MATH_1_1 release branch r321516-358399 Added: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt (with props) Removed: jakarta/commons/proper/math/trunk/src/conf/MANIFEST.MF Modified: jakarta/commons/proper/math/trunk/build.xml jakarta/commons/proper/math/trunk/project.xml jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/StatisticalSummaryValues.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/SummaryStatisticsImpl.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Median.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ContinuedFraction.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/DefaultTransformer.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/package.html jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/NewtonSolverTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/QuinticFunction.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/HypergeometricDistributionTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/PoissonDistributionTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/rank/PercentileTest.java jakarta/commons/proper/math/trunk/xdocs/changes.xml Modified: jakarta/commons/proper/math/trunk/build.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/build.xml?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/build.xml (original) +++ jakarta/commons/proper/math/trunk/build.xml Thu Dec 22 13:16:32 2005 @@ -1,7 +1,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -176,7 +176,7 @@ - + Modified: jakarta/commons/proper/math/trunk/project.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/project.xml?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/project.xml (original) +++ jakarta/commons/proper/math/trunk/project.xml Thu Dec 22 13:16:32 2005 @@ -105,6 +105,11 @@ 1.1 MATH_1_1 + + 1.2-SNAPSHOT + 1.1 + trunk + Added: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt?rev=358631&view=auto ============================================================================== --- jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt (added) +++ jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt Thu Dec 22 13:16:32 2005 @@ -0,0 +1,3 @@ +Build-Jdk: 1.3.1_16 +Specification-Version: 1.1 +Implementation-Vendor-Id: org.apache Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java Thu Dec 22 13:16:32 2005 @@ -26,7 +26,7 @@ public class ConvergenceException extends MathException implements Serializable{ /** Serializable version identifier */ - static final long serialVersionUID = -3657394299929217890L; + private static final long serialVersionUID = -3657394299929217890L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java Thu Dec 22 13:16:32 2005 @@ -26,7 +26,7 @@ public class FunctionEvaluationException extends MathException { /** Serializable version identifier */ - static final long serialVersionUID = -317289374378977972L; + private static final long serialVersionUID = -317289374378977972L; /** Argument causing function evaluation failure */ private double argument = Double.NaN; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java Thu Dec 22 13:16:32 2005 @@ -24,7 +24,7 @@ public class MathConfigurationException extends MathException implements Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -7958299004965931723L; + private static final long serialVersionUID = -7958299004965931723L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ public class MathException extends Exception { /** Serializable version identifier */ - static final long serialVersionUID = -8594613561393443827L; + private static final long serialVersionUID = -8594613561393443827L; /** * Does JDK support nested exceptions? Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java Thu Dec 22 13:16:32 2005 @@ -29,7 +29,7 @@ public class BisectionSolver extends UnivariateRealSolverImpl { /** Serializable version identifier */ - static final long serialVersionUID = 7137520585963699578L; + private static final long serialVersionUID = 7137520585963699578L; /** * Construct a solver for the given function. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java Thu Dec 22 13:16:32 2005 @@ -30,7 +30,7 @@ public class BrentSolver extends UnivariateRealSolverImpl { /** Serializable version identifier */ - static final long serialVersionUID = 3350616277306882875L; + private static final long serialVersionUID = 3350616277306882875L; /** * Construct a solver for the given function. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java Thu Dec 22 13:16:32 2005 @@ -16,6 +16,7 @@ package org.apache.commons.math.analysis; +import java.io.IOException; import org.apache.commons.math.ConvergenceException; import org.apache.commons.math.FunctionEvaluationException; @@ -30,10 +31,10 @@ public class NewtonSolver extends UnivariateRealSolverImpl { /** Serializable version identifier */ - static final long serialVersionUID = 2606474895443431607L; + private static final long serialVersionUID = 2606474895443431607L; /** The first derivative of the target function. */ - private UnivariateRealFunction derivative; + private transient UnivariateRealFunction derivative; /** * Construct a solver for the given function. @@ -97,5 +98,17 @@ throw new ConvergenceException ("Maximum number of iterations exceeded " + i); } - + + /** + * Custom deserialization to initialize transient deriviate field. + * + * @param in serialized object input stream + * @throws IOException if IO error occurs + * @throws ClassNotFoundException if instantiation error occurs + */ + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { + in.defaultReadObject(); + derivative = ((DifferentiableUnivariateRealFunction) f).derivative(); + } } Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java Thu Dec 22 13:16:32 2005 @@ -28,7 +28,7 @@ public class PolynomialFunction implements DifferentiableUnivariateRealFunction, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 3322454535052136809L; + private static final long serialVersionUID = 3322454535052136809L; /** * The coefficients of the polynomial, ordered by degree -- i.e., Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java Thu Dec 22 13:16:32 2005 @@ -52,10 +52,11 @@ * * @version $Revision$ $Date$ */ -public class PolynomialSplineFunction implements UnivariateRealFunction, Serializable { +public class PolynomialSplineFunction + implements DifferentiableUnivariateRealFunction, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 7011031166416885789L; + private static final long serialVersionUID = 7011031166416885789L; /** Spline segment interval delimiters (knots). Size is n+1 for n segments. */ private double knots[]; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java Thu Dec 22 13:16:32 2005 @@ -40,7 +40,7 @@ public class SecantSolver extends UnivariateRealSolverImpl implements Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 1984971194738974867L; + private static final long serialVersionUID = 1984971194738974867L; /** * Construct a solver for the given function. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java Thu Dec 22 13:16:32 2005 @@ -16,7 +16,7 @@ package org.apache.commons.math.analysis; /** - * Computes a natural (a.k.a. "free", "unclamped") cubic spline interpolation for the data set. + * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set. *

* The {@link #interpolate(double[], double[])} method returns a {@link PolynomialSplineFunction} * consisting of n cubic polynomials, defined over the subintervals determined by the x values, Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java Thu Dec 22 13:16:32 2005 @@ -30,7 +30,7 @@ Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 1112491292565386596L; + private static final long serialVersionUID = 1112491292565386596L; /** Maximum absolute error. */ protected double absoluteAccuracy; @@ -265,9 +265,9 @@ */ protected boolean isBracketing(double lower, double upper, UnivariateRealFunction f) throws FunctionEvaluationException { - double f1 = f.value(lower); - double f2 = f.value(upper); - return ((f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0)); + double f1 = f.value(lower); + double f2 = f.value(upper); + return ((f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0)); } /** Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java Thu Dec 22 13:16:32 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,16 @@ /** * Representation of a Complex number - a number which has both a * real and imaginary part. + *

+ * Implementations of arithmetic operations handle NaN and + * infinite values according to the rules for {@link java.lang.Double} + * arithmetic, applying definitional formulas and returning NaN or + * infinite values in real or imaginary parts as these arise in computation. + * See individual method javadocs for details. + *

+ * {@link #equals} identifies all values with NaN in either real + * or imaginary part - e.g.,

+ * 1 + NaNi  == NaN + i == NaN + NaNi.
* * @author Apache Software Foundation * @version $Revision$ $Date$ @@ -29,28 +39,31 @@ public class Complex implements Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -6530173849413811929L; + private static final long serialVersionUID = -6530173849413811929L; - /** The square root of -1. A number representing "0.0 + 1.0i".*/ + /** The square root of -1. A number representing "0.0 + 1.0i" */ public static final Complex I = new Complex(0.0, 1.0); - /** A complex number analogous to {@link java.lang.Double#NaN} */ + /** A complex number representing "NaN + NaNi" */ public static final Complex NaN = new Complex(Double.NaN, Double.NaN); /** A complex number representing "1.0 + 0.0i" */ public static final Complex ONE = new Complex(1.0, 0.0); - /** The imaginary part. */ + /** A complex number representing "0.0 + 0.0i" */ + public static final Complex ZERO = new Complex(0.0, 0.0); + + /** The imaginary part */ protected double imaginary; - /** The real part. */ + /** The real part */ protected double real; /** * Create a complex number given the real and imaginary parts. * - * @param real the real part. - * @param imaginary the imaginary part. + * @param real the real part + * @param imaginary the imaginary part */ public Complex(double real, double imaginary) { super(); @@ -60,13 +73,23 @@ /** * Return the absolute value of this complex number. + *

+ * Returns NaN if either real or imaginary part is + * NaN and Double.POSITIVE_INFINITY if + * neither part is NaN, but at least one part takes an infinite + * value. * - * @return the absolute value. + * @return the absolute value */ public double abs() { if (isNaN()) { return Double.NaN; } + + if (isInfinite()) { + return Double.POSITIVE_INFINITY; + } + if (Math.abs(real) < Math.abs(imaginary)) { if (imaginary == 0.0) { return Math.abs(real); @@ -84,38 +107,81 @@ /** * Return the sum of this complex number and the given complex number. - * - * @param rhs the other complex number. - * @return the complex number sum. + *

+ * Uses the definitional formula + *

+     * (a + bi) + (c + di) = (a+c) + (b+d)i
+     * 
+ *

+ * If either this or rhs has a NaN value in either part, + * {@link #NaN} is returned; otherwise Inifinite and NaN values are + * returned in the parts of the result according to the rules for + * {@link java.lang.Double} arithmetic. + * + * @param rhs the other complex number + * @return the complex number sum + * @throws NullPointerException if rhs is null */ - public Complex add(Complex rhs) { - if (isNaN() || rhs.isNaN()) { - return NaN; - } - + public Complex add(Complex rhs) { return new Complex(real + rhs.getReal(), imaginary + rhs.getImaginary()); } /** - * Return the conjugate of this complex number. The conjugate of - * "A + Bi" is "A - Bi". Complex.NaN is returned if either the real or imaginary part of - * this Complex number equals Double.NaN. + * Return the conjugate of this complex number. The conjugate of + * "A + Bi" is "A - Bi". + *

+ * {@link #NaN} is returned if either the real or imaginary + * part of this Complex number equals Double.NaN. + *

+ * If the imaginary part is infinite, and the real part is not NaN, + * the returned value has infinite imaginary part of the opposite + * sign - e.g. the conjugate of 1 + POSITIVE_INFINITY i + * is 1 - NEGATIVE_INFINITY i * * @return the conjugate of this Complex object */ public Complex conjugate() { if (isNaN()) { return NaN; - } - + } return new Complex(real, -imaginary); } /** * Return the quotient of this complex number and the given complex number. - * @param rhs the other complex number. - * @return the complex number quotient. + *

+ * Implements the definitional formula + *


+     *    a + bi          ac + bd + (bc - ad)i
+     *    ----------- = -------------------------
+     *    c + di               c2 + d2
+     * 
+ * but uses + * + * prescaling of operands to limit the effects of overflows and + * underflows in the computation. + *

+ * Infinite and NaN values are handled / returned according to the + * following rules, applied in the order presented: + *

    + *
  • If either this or rhs has a NaN value in either part, + * {@link #NaN} is returned.
  • + *
  • If rhs equals {@link #ZERO}, {@link #NaN} is returned. + *
  • + *
  • If this and rhs are both infinite, + * {@link #NaN} is returned.
  • + *
  • If this is finite (i.e., has no infinite or NaN parts) and + * rhs is infinite (one or both parts infinite), + * {@link #ZERO} is returned.
  • + *
  • If this is infinite and rhs is finite, NaN values are + * returned in the parts of the result if the {@link java.lang.Double} + * rules applied to the definitional formula force NaN results.
  • + *
+ * + * @param rhs the other complex number + * @return the complex number quotient + * @throws NullPointerException if rhs is null */ public Complex divide(Complex rhs) { if (isNaN() || rhs.isNaN()) { @@ -125,7 +191,11 @@ double c = rhs.getReal(); double d = rhs.getImaginary(); if (c == 0.0 && d == 0.0) { - throw new ArithmeticException("Error: division by zero."); + return NaN; + } + + if (rhs.isInfinite() && !isInfinite()) { + return ZERO; } if (Math.abs(c) < Math.abs(d)) { @@ -156,13 +226,13 @@ *

* All NaN values are considered to be equal - i.e, if either * (or both) real and imaginary parts of the complex number are equal - * to Double.NaN, the complex number is equal to + * to Double.NaN, the complex number is equal to * Complex.NaN. * * @param other Object to test for equality to this * @return true if two Complex objects are equal, false if * object is null, not an instance of Complex, or - * not equal to this Complex instance. + * not equal to this Complex instance * */ public boolean equals(Object other) { @@ -210,7 +280,7 @@ /** * Access the imaginary part. * - * @return the imaginary part. + * @return the imaginary part */ public double getImaginary() { return imaginary; @@ -219,44 +289,76 @@ /** * Access the real part. * - * @return the real part. + * @return the real part */ public double getReal() { return real; } /** - * Returns true if this complex number is the special Not-a-Number (NaN) - * value. + * Returns true if either or both parts of this complex number is NaN; + * false otherwise * - * @return true if the value represented by this object is NaN; false - * otherwise. + * @return true if either or both parts of this complex number is NaN; + * false otherwise */ public boolean isNaN() { return Double.isNaN(real) || Double.isNaN(imaginary); } /** + * Returns true if either the real or imaginary part of this complex number + * takes an infinite value (either Double.POSITIVE_INFINITY or + * Double.NEGATIVE_INFINITY) and neither part + * is NaN. + * + * @return true if one or both parts of this complex number are infinite + * and neither part is NaN + */ + public boolean isInfinite() { + return !isNaN() && + (Double.isInfinite(real) || Double.isInfinite(imaginary)); + } + + /** * Return the product of this complex number and the given complex number. - * - * @param rhs the other complex number. - * @return the complex number product. + *

+ * Implements the definitional formula: + *


+     * (a + bi)(c + di) = (ac - bd) + (ad + bc)i
+     * 
+ *

+ * Returns {@link #NaN} if either this or rhs has one or more + * NaN parts. + *

+ * Returns NaN or infinite values in components of the result per the + * definitional formula and and the rules for {@link java.lang.Double} + * arithmetic. Examples: + *


+     *  (1 + i) (INF + i)  =  INF + INFi
+     *  (1 + INFi) (1 - INFi) = INF + NaNi
+     *  (-INF + -INFi)(1 + NaNi) = NaN + NaNi
+     *  
+ * + * @param rhs the other complex number + * @return the complex number product + * @throws NullPointerException if rhs is null */ public Complex multiply(Complex rhs) { if (isNaN() || rhs.isNaN()) { return NaN; } - - double p = (real + imaginary) * (rhs.getReal() + rhs.getImaginary()); - double ac = real * rhs.getReal(); - double bd = imaginary * rhs.getImaginary(); - return new Complex(ac - bd, p - ac - bd); + return new Complex(real * rhs.real - imaginary * rhs.imaginary, + real * rhs.imaginary + imaginary * rhs.real); } /** * Return the additive inverse of this complex number. + *

+ * Returns Complex.NaN if either real or imaginary + * part of this Complex number equals Double.NaN. * - * @return the negation of this complex number. + * @return the negation of this complex number */ public Complex negate() { if (isNaN()) { @@ -269,9 +371,20 @@ /** * Return the difference between this complex number and the given complex * number. - * - * @param rhs the other complex number. - * @return the complex number difference. + *

+ * Uses the definitional formula + *

+     * (a + bi) - (c + di) = (a-c) + (b-d)i
+     * 
+ *

+ * If either this or rhs has a NaN value in either part, + * {@link #NaN} is returned; otherwise inifinite and NaN values are + * returned in the parts of the result according to the rules for + * {@link java.lang.Double} arithmetic. + * + * @param rhs the other complex number + * @return the complex number difference + * @throws NullPointerException if rhs is null */ public Complex subtract(Complex rhs) { if (isNaN() || rhs.isNaN()) { Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java Thu Dec 22 13:16:32 2005 @@ -35,7 +35,7 @@ public class ComplexFormat extends Format implements Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -6337346779577272306L; + private static final long serialVersionUID = -6337346779577272306L; /** The default imaginary character. */ private static final String DEFAULT_IMAGINARY_CHARACTER = "i"; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java Thu Dec 22 13:16:32 2005 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,20 @@ import org.apache.commons.math.util.MathUtils; /** - * Implementations of various transcendental functions for - * {@link org.apache.commons.math.complex.Complex} arguments. - * + * Static implementations of common + * {@link org.apache.commons.math.complex.Complex}-valued functions. Included + * are trigonometric, exponential, log, power and square root functions. + *

* Reference: *

+ * See individual method javadocs for the computational formulas used. + * In general, NaN values in either real or imaginary parts of input arguments + * result in {@link Complex#NaN} returned. Otherwise, infinite or NaN values + * are returned as they arise in computing the real functions specified in the + * computational formulas. Null arguments result in NullPointerExceptions. * * @version $Revision$ $Date$ */ @@ -40,10 +46,19 @@ } /** - * Compute the + * Compute the + * * inverse cosine for the given complex argument. - * @param z the value whose inverse cosine is to be returned. - * @return the inverse cosine of z. + *

+ * Implements the formula:

+     *  acos(z) = -i (log(z + i (sqrt(1 - z2))))
+ *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN or infinite. + * + * @param z the value whose inverse cosine is to be returned + * @return the inverse cosine of z + * @throws NullPointerException if z is null */ public static Complex acos(Complex z) { if (z.isNaN()) { @@ -55,10 +70,19 @@ } /** - * Compute the + * Compute the + * * inverse sine for the given complex argument. + *

+ * Implements the formula:

+     *  asin(z) = -i (log(sqrt(1 - z2) + iz)) 
+ *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN or infinite. + * * @param z the value whose inverse sine is to be returned. * @return the inverse sine of z. + * @throws NullPointerException if z is null */ public static Complex asin(Complex z) { if (z.isNaN()) { @@ -70,27 +94,56 @@ } /** - * Compute the + * Compute the + * * inverse tangent for the given complex argument. - * @param z the value whose inverse tangent is to be returned. - * @return the inverse tangent of z. + *

+ * Implements the formula:

+     *  atan(z) = (i/2) log((i + z)/(i - z)) 
+ *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN or infinite. + * + * @param z the value whose inverse tangent is to be returned + * @return the inverse tangent of z + * @throws NullPointerException if z is null */ public static Complex atan(Complex z) { if (z.isNaN()) { return Complex.NaN; } - return Complex.I.multiply( log(Complex.I.add(z).divide(Complex.I.subtract(z)))) .divide(new Complex(2.0, 0.0)); } /** - * Compute the cosine + * Compute the + * + * cosine * for the given complex argument. - * @param z the value whose cosine is to be returned. - * @return the cosine of z. + *

+ * Implements the formula:

+     *  cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * cos(1 ± INFINITY i) = 1 ∓ INFINITY i
+     * cos(±INFINITY + i) = NaN + NaN i
+     * cos(±INFINITY ± INFINITY i) = NaN + NaN i
+ * + * @param z the value whose cosine is to be returned + * @return the cosine of z + * @throws NullPointerException if z is null */ public static Complex cos(Complex z) { if (z.isNaN()) { @@ -105,8 +158,29 @@ } /** - * Compute the + * Compute the + * * hyperbolic cosine for the given complex argument. + *

+ * Implements the formula:

+     *  cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * cosh(1 ± INFINITY i) = NaN + NaN i
+     * cosh(±INFINITY + i) = INFINITY ± INFINITY i
+     * cosh(±INFINITY ± INFINITY i) = NaN + NaN i
+ *

+ * Throws NullPointerException if z is null. + * * @param z the value whose hyperbolic cosine is to be returned. * @return the hyperbolic cosine of z. */ @@ -124,10 +198,31 @@ /** * Compute the - * + * * exponential function for the given complex argument. - * @param z the value. - * @return ez. + *

+ * Implements the formula:

+     *  exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#exp}, {@link java.lang.Math#cos}, and + * {@link java.lang.Math#sin}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * exp(1 ± INFINITY i) = NaN + NaN i
+     * exp(INFINITY + i) = INFINITY + INFINITY i
+     * exp(-INFINITY + i) = 0 + 0i
+     * exp(±INFINITY ± INFINITY i) = NaN + NaN i
+ *

+ * Throws NullPointerException if z is null. + * + * @param z the value + * @return ez */ public static Complex exp(Complex z) { if (z.isNaN()) { @@ -136,14 +231,36 @@ double b = z.getImaginary(); double expA = Math.exp(z.getReal()); - double sinB = Math.sin(b); - double cosB = Math.cos(b); - return new Complex(expA * cosB, expA * sinB); + return new Complex(expA * Math.cos(b), expA * Math.sin(b)); } /** - * Compute the + * Compute the + * * natural logarithm for the given complex argument. + *

+ * Implements the formula:

+     *  log(a + bi) = ln(|a + bi|) + arg(a + bi)i
+ * where ln on the right hand side is {@link java.lang.Math#log}, + * |a + bi| is the modulus, {@link Complex#abs}, and + * arg(a + bi) = {@link java.lang.Math#atan2}(b, a) + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite (or critical) values in real or imaginary parts of the input may + * result in infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * log(1 ± INFINITY i) = INFINITY ± (π/2)i
+     * log(INFINITY + i) = INFINITY + 0i
+     * log(-INFINITY + i) = INFINITY + πi
+     * log(INFINITY ± INFINITY i) = INFINITY ± (π/4)i
+     * log(-INFINITY ± INFINITY i) = INFINITY ± (3π/4)i
+     * log(0 + 0i) = -INFINITY + 0i
+     * 
+ * Throws NullPointerException if z is null. + * * @param z the value. * @return ln z. */ @@ -156,20 +273,85 @@ Math.atan2(z.getImaginary(), z.getReal())); } + /** + * Creates a complex number from the given polar representation. + *

+ * The value returned is r·ei·theta, + * computed as r·cos(theta) + r·sin(theta)i + *

+ * If either r or theta is NaN, or + * theta is infinite, {@link Complex#NaN} is returned. + *

+ * If r is infinite and theta is finite, + * infinite or NaN values may be returned in parts of the result, following + * the rules for double arithmetic.

+     * Examples: 
+     * 
+     * polar2Complex(INFINITY, π/4) = INFINITY + INFINITY i
+     * polar2Complex(INFINITY, 0) = INFINITY + NaN i
+     * polar2Complex(INFINITY, -π/4) = INFINITY - INFINITY i
+     * polar2Complex(INFINITY, 5π/4) = -INFINITY - INFINITY i 
+ * + * @param r the modulus of the complex number to create + * @param theta the argument of the complex number to create + * @return r·ei·theta + * @throws IllegalArgumentException if r is negative + * @since 1.1 + */ + public static Complex polar2Complex(double r, double theta) { + if (r < 0) { + throw new IllegalArgumentException + ("Complex modulus must not be negative"); + } + return new Complex(r * Math.cos(theta), r * Math.sin(theta)); + } /** * Returns of value of y raised to the power of x. + *

+ * Implements the formula:

+     *  yx = exp(x·log(y))
+ * where exp and log are {@link #exp} and + * {@link #log}, respectively. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN or infinite, or if y + * equals {@link Complex#ZERO}. + * * @param y the base. * @param x the exponent. - * @return yz. + * @return yx + * @throws NullPointerException if either x or y is null */ public static Complex pow(Complex y, Complex x) { return exp(x.multiply(log(y))); } /** - * Compute the sine + * Compute the + * + * sine * for the given complex argument. + *

+ * Implements the formula:

+     *  sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * sin(1 ± INFINITY i) = 1 ± INFINITY i
+     * sin(±INFINITY + i) = NaN + NaN i
+     * sin(±INFINITY ± INFINITY i) = NaN + NaN i
+ * + * Throws NullPointerException if z is null. + * * @param z the value whose sine is to be returned. * @return the sine of z. */ @@ -186,10 +368,30 @@ } /** - * Compute the + * Compute the + * * hyperbolic sine for the given complex argument. - * @param z the value whose hyperbolic sine is to be returned. - * @return the hyperbolic sine of z. + *

+ * Implements the formula:

+     *  sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * sinh(1 ± INFINITY i) = NaN + NaN i
+     * sinh(±INFINITY + i) = ± INFINITY + INFINITY i
+     * sinh(±INFINITY ± INFINITY i) = NaN + NaN i
z + * @throws NullPointerException if z is null */ public static Complex sinh(Complex z) { if (z.isNaN()) { @@ -204,10 +406,38 @@ } /** - * Compute the squre - * root for the given complex argument. - * @param z the value whose square root is to be returned. - * @return the square root of z. + * Compute the + * + * square root for the given complex argument. + *

+ * Implements the following algorithm to compute sqrt(a + bi): + *

  1. Let t = sqrt((|a| + |a + bi|) / 2)
  2. + *
  3. if  a ≥ 0 return t + (b/2t)i
    +     *  else return |b|/2t + sign(b)t i 
  4. + *
+ * where
    + *
  • |a| = {@link Math#abs}(a)
  • + *
  • |a + bi| = {@link Complex#abs}(a + bi)
  • + *
  • sign(b) = {@link MathUtils#indicator}(b) + *
+ *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * sqrt(1 ± INFINITY i) = INFINITY + NaN i
+     * sqrt(INFINITY + i) = INFINITY + 0i
+     * sqrt(-INFINITY + i) = 0 + INFINITY i
+     * sqrt(INFINITY ± INFINITY i) = INFINITY + NaN i
+     * sqrt(-INFINITY ± INFINITY i) = NaN ± INFINITY i
+     * 
+ * + * @param z the value whose square root is to be returned + * @return the square root of z + * @throws NullPointerException if z is null */ public static Complex sqrt(Complex z) { if (z.isNaN()) { @@ -230,20 +460,54 @@ } /** - * Compute the squre - * root of 1 - z2 for the given complex argument. - * @param z the value. - * @return the square root of 1 - z2. + * Compute the + * + * square root of 1 - z2 for the given complex + * argument. + *

+ * Computes the result directly as + * sqrt(Complex.ONE.subtract(z.multiply(z))). + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result. + * + * @param z the value + * @return the square root of 1 - z2 + * @throws NullPointerException if z is null */ public static Complex sqrt1z(Complex z) { return sqrt(Complex.ONE.subtract(z.multiply(z))); } /** - * Compute the + * Compute the + * * tangent for the given complex argument. - * @param z the value whose tangent is to be returned. - * @return the tangent of z. + *

+ * Implements the formula:

+     * tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite (or critical) values in real or imaginary parts of the input may + * result in infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * tan(1 ± INFINITY i) = 0 + NaN i
+     * tan(±INFINITY + i) = NaN + NaN i
+     * tan(±INFINITY ± INFINITY i) = NaN + NaN i
+     * tan(±&pi/2 + 0 i) = ±INFINITY + NaN i
+ * + * @param z the value whose tangent is to be returned + * @return the tangent of z + * @throws NullPointerException if z is null */ public static Complex tan(Complex z) { if (z.isNaN()) { @@ -259,10 +523,30 @@ /** * Compute the - * + * * hyperbolic tangent for the given complex argument. - * @param z the value whose hyperbolic tangent is to be returned. - * @return the hyperbolic tangent of z. + *

+ * Implements the formula:

+     * tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i
+ * where the (real) functions on the right-hand side are + * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, + * {@link MathUtils#cosh} and {@link MathUtils#sinh}. + *

+ * Returns {@link Complex#NaN} if either real or imaginary part of the + * input argument is NaN. + *

+ * Infinite values in real or imaginary parts of the input may result in + * infinite or NaN values returned in parts of the result.

+     * Examples: 
+     * 
+     * tanh(1 ± INFINITY i) = NaN + NaN i
+     * tanh(±INFINITY + i) = NaN + 0 i
+     * tanh(±INFINITY ± INFINITY i) = NaN + NaN i
+     * tanh(0 + (&pi/2)i) = NaN + INFINITY i
+ * + * @param z the value whose hyperbolic tangent is to be returned + * @return the hyperbolic tangent of z + * @throws NullPointerException if z is null */ public static Complex tanh(Complex z) { if (z.isNaN()) { Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Thu Dec 22 13:16:32 2005 @@ -35,7 +35,7 @@ implements ContinuousDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -38038050983108802L; + private static final long serialVersionUID = -38038050983108802L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java Thu Dec 22 13:16:32 2005 @@ -28,7 +28,7 @@ implements Distribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -38038050983108802L; + private static final long serialVersionUID = -38038050983108802L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ implements IntegerDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -1146319659338487221L; + private static final long serialVersionUID = -1146319659338487221L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ implements BinomialDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 6751309484392813623L; + private static final long serialVersionUID = 6751309484392813623L; /** The number of trials. */ private int numberOfTrials; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -29,7 +29,7 @@ implements CauchyDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 8589540077390120676L; + private static final long serialVersionUID = 8589540077390120676L; /** The median of this distribution. */ private double median = 0; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -29,7 +29,7 @@ implements ChiSquaredDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -8352658048349159782L; + private static final long serialVersionUID = -8352658048349159782L; /** Internal Gamma distribution. */ private GammaDistribution gamma; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -20,7 +20,7 @@ import org.apache.commons.math.MathException; /** - * The default implementation of {@link ExponentialDistribution} + * The default implementation of {@link ExponentialDistribution}. * * @version $Revision$ $Date$ */ @@ -28,7 +28,7 @@ implements ExponentialDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 2401296428283614780L; + private static final long serialVersionUID = 2401296428283614780L; /** The mean of this distribution. */ private double mean; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ implements FDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -8516354193418641566L; + private static final long serialVersionUID = -8516354193418641566L; /** The numerator degrees of freedom*/ private double numeratorDegreesOfFreedom; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -21,7 +21,7 @@ import org.apache.commons.math.special.Gamma; /** - * The default implementation of {@link GammaDistribution} + * The default implementation of {@link GammaDistribution}. * * @version $Revision$ $Date$ */ @@ -29,7 +29,7 @@ implements GammaDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -3239549463135430361L; + private static final long serialVersionUID = -3239549463135430361L; /** The shape parameter. */ private double alpha; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -30,7 +30,7 @@ { /** Serializable version identifier */ - static final long serialVersionUID = -436928820673516179L; + private static final long serialVersionUID = -436928820673516179L; /** The number of successes in the population. */ private int numberOfSuccesses; @@ -53,8 +53,8 @@ super(); if (numberOfSuccesses > populationSize) { throw new IllegalArgumentException( - "number of successes must be less than or equal to " + - "population size"); + "number of successes must be less than or equal to " + + "population size"); } if (sampleSize > populationSize) { throw new IllegalArgumentException( @@ -241,7 +241,7 @@ populationSize = size; } - /** + /** * Modify the sample size. * @param size the new sample size. * @throws IllegalArgumentException if size is negative. @@ -260,9 +260,9 @@ * @return upper tail CDF for this distribution. * @since 1.1 */ - public double upperCumulativeProbability(int x) { - double ret; - + public double upperCumulativeProbability(int x) { + double ret; + int n = getPopulationSize(); int m = getNumberOfSuccesses(); int k = getSampleSize(); @@ -273,12 +273,12 @@ } else if(x > domain[1]) { ret = 0.0; } else { - ret = innerCumulativeProbability(domain[1], x, -1, n, m, k); + ret = innerCumulativeProbability(domain[1], x, -1, n, m, k); } return ret; } - + /** * For this disbution, X, this method returns P(x0 ≤ X ≤ x1). This * probability is computed by summing the point probabilities for the values @@ -293,13 +293,13 @@ * @return P(x0 ≤ X ≤ x1). */ private double innerCumulativeProbability( - int x0, int x1, int dx, int n, int m, int k) + int x0, int x1, int dx, int n, int m, int k) { - double ret = probability(n, m, k, x0); - while (x0 != x1) { - x0 += dx; - ret += probability(n, m, k, x0); - } - return ret; - } + double ret = probability(n, m, k, x0); + while (x0 != x1) { + x0 += dx; + ret += probability(n, m, k, x0); + } + return ret; + } } Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ implements NormalDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 8589540077390120676L; + private static final long serialVersionUID = 8589540077390120676L; /** The mean of this distribution. */ private double mean = 0; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -22,7 +22,7 @@ import org.apache.commons.math.util.MathUtils; /** - * Implementation for the {@link PoissonDistribution} + * Implementation for the {@link PoissonDistribution}. * * @version $Revision$ $Date$ */ @@ -30,7 +30,7 @@ implements PoissonDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -3349935121172596109L; + private static final long serialVersionUID = -3349935121172596109L; /** * Holds the Poisson mean for the distribution. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ implements TDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -5852615386664158222L; + private static final long serialVersionUID = -5852615386664158222L; /** The degrees of freedom*/ private double degreesOfFreedom; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -29,7 +29,7 @@ implements WeibullDistribution, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 8589540077390120676L; + private static final long serialVersionUID = 8589540077390120676L; /** The shape parameter. */ private double alpha; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java Thu Dec 22 13:16:32 2005 @@ -34,7 +34,7 @@ public static final Fraction ZERO = new Fraction(0, 1); /** Serializable version identifier */ - static final long serialVersionUID = 65382027393090L; + private static final long serialVersionUID = 65382027393090L; /** The denominator. */ private int denominator; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java Thu Dec 22 13:16:32 2005 @@ -37,7 +37,7 @@ public class FractionFormat extends Format implements Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -6337346779577272306L; + private static final long serialVersionUID = -6337346779577272306L; /** The format used for the denominator. */ private NumberFormat denominatorFormat; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java Thu Dec 22 13:16:32 2005 @@ -31,7 +31,7 @@ public class ProperFractionFormat extends FractionFormat { /** Serializable version identifier */ - static final long serialVersionUID = -6337346779577272307L; + private static final long serialVersionUID = -6337346779577272307L; /** The format used for the whole number. */ private NumberFormat wholeFormat; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java Thu Dec 22 13:16:32 2005 @@ -19,7 +19,7 @@ import java.math.BigDecimal; /** - * Implementation for {@link BigMatrix} using a BigDecimal[][] array to store entries + * Implementation of {@link BigMatrix} using a BigDecimal[][] array to store entries * and * LU decompostion to support linear system * solution and inverse. @@ -48,7 +48,7 @@ public class BigMatrixImpl implements BigMatrix, Serializable { /** Serialization id */ - static final long serialVersionUID = -1011428905656140431L; + private static final long serialVersionUID = -1011428905656140431L; /** Entries of the matrix */ private BigDecimal data[][] = null; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java Thu Dec 22 13:16:32 2005 @@ -25,7 +25,7 @@ public class InvalidMatrixException extends RuntimeException { /** Serializable version identifier */ - static final long serialVersionUID = 5318837237354354107L; + private static final long serialVersionUID = 5318837237354354107L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java Thu Dec 22 13:16:32 2005 @@ -24,7 +24,7 @@ public class MatrixIndexException extends RuntimeException { /** Serializable version identifier */ - static final long serialVersionUID = -1341109412864309526L; + private static final long serialVersionUID = -1341109412864309526L; /** * Default constructor. Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java Thu Dec 22 13:16:32 2005 @@ -21,7 +21,7 @@ /** - * Implementation for RealMatrix using a double[][] array to store entries and + * Implementation of RealMatrix using a double[][] array to store entries and * * LU decompostion to support linear system * solution and inverse. @@ -50,7 +50,7 @@ public class RealMatrixImpl implements RealMatrix, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = 4237564493130426188L; + private static final long serialVersionUID = 4237564493130426188L; /** Entries of the matrix */ private double data[][] = null; Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java Thu Dec 22 13:16:32 2005 @@ -59,13 +59,13 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistribution { /** Serializable version identifier */ - static final long serialVersionUID = -6773236347582113490L; + private static final long serialVersionUID = -6773236347582113490L; /** List of SummaryStatistics objects characterizing the bins */ private ArrayList binStats = null; /** Sample statistics */ - SummaryStatistics sampleStats = null; + private SummaryStatistics sampleStats = null; /** number of bins */ private int binCount = 1000; @@ -225,7 +225,7 @@ private class StreamDataAdapter extends DataAdapter{ /** Input stream providng access to the data */ - BufferedReader inputStream; + private BufferedReader inputStream; /** * Create a StreamDataAdapter from a BufferedReader @@ -380,7 +380,7 @@ * @param min the minimum value * @param value the value whose bin we are trying to find * @param delta the grid size - * @return + * @return the index of the bin containing the value */ private int findBin(double min, double value, double delta) { return Math.min( @@ -453,14 +453,18 @@ } /** - * Returns the array of upper bounds for the bins. Bins are:
+ * Returns (a fresh copy of) the array of upper bounds for the bins. + Bins are:
* [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],..., * (upperBounds[binCount-1],max] * * @return array of bin upper bounds */ public double[] getUpperBounds() { - return upperBounds; + int len = upperBounds.length; + double[] out = new double[len]; + System.arraycopy(upperBounds, 0, out, 0, len); + return out; } /** Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java Thu Dec 22 13:16:32 2005 @@ -18,7 +18,7 @@ import java.util.Collection; /** - * Random data generation utilities + * Random data generation utilities. * @version $Revision$ $Date$ */ public interface RandomData { Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java?rev=358631&r1=358630&r2=358631&view=diff ============================================================================== --- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java (original) +++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java Thu Dec 22 13:16:32 2005 @@ -81,7 +81,7 @@ public class RandomDataImpl implements RandomData, Serializable { /** Serializable version identifier */ - static final long serialVersionUID = -626730818244969716L; + private static final long serialVersionUID = -626730818244969716L; /** underlying random number generator */ private RandomGenerator rand = null; --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org